Hi, I don't know if I set this issue in the correct place ;) but I have a problem with .net Core 3.0.
When I try to start.process I get an error:
Exception has occurred: CLR/System.ComponentModel.Win32Exception
An unhandled type exception has occurred „System.ComponentModel.Win32Exception” w System.Diagnostics.Process.dll: 'The specified file can not be found.'
in System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
in System.Diagnostics.Process.Start()
in System.Diagnostics.Process.Start(ProcessStartInfo startInfo)
in System.Diagnostics.Process.Start(String fileName)
in simpleApp.Form1.count_Click(Object sender, EventArgs e) in c:\Repozytoria\Visual Studio\simpleApp\Form1.cs:line 17
in System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
in System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
in System.Windows.Forms.Control.WndProc(Message& m)
in System.Windows.Forms.ButtonBase.WndProc(Message& m)
in System.Windows.Forms.Button.WndProc(Message& m)
in System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
in System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
in System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
in System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
in System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
in simpleApp.Program.Main() w c:\Repozytoria\Visual Studio\simpleApp\Program.cs:line 19
How to reproduce:
Create those functions in .net Core 3.0 preview:
C#
private void openWebPage()
{
System.Diagnostics.Process.Start("http://google.com);
}
Version
3.0.100-preview6-012264
Language
C#
How to reproduce
What language are you using? That sample code is not C#, Visual Basic, or F#.
I think the problem though is, that in .NET Core is a change of behavior in UseShellExecute and it needs to explicitly be set to true. The C# equiviant of this would be something like:
Process.Start(new ProcessStartInfo {
UseShellExecute = true,
FileName = "https://www.google.com"
}).Dispose();
@vcsjones @stephentoub
Sorry, my fault.
The language is C# and .net Core
I corrected How to reproduce
@moleszek Can you please try the example above I gave as a solution for openWebPage method? In .NET Core, you need to set UseShellExecute to true. In the .NET Framework, the default was true which is why you didn't need to do it this way with the Desktop .NET Framework.
For openSimple there isn't enough information to help troubleshoot why that might not be working for you. Further, I don't see File.Open anywhere in your error's stacktrace. Do you have an error for using File.Open?
@vcsjones I've tried with the solution you gave and it works.
For File.Open I had similar error but I guess I could possibly do something wrong because I'm not able to reproduce it right now.
I've edited ticket and removed File.Open problem so it won't be confusing.
Thanks for the help and this issue can be closed.