Porting a .Net Framework App to .Net Core 3.0, I was not able to invoke the default mail client with the mailto: protocoll using System.Diagnostics.Process.Start(...).
.Net Core 3.0.100-preview5-011568
Windows 10 1809
Outlook 2016
Sampe code to reproduce
```c#
var body = "This is a body of a message";
var recipients = String.Join(",", "[email protected]", "[email protected]");
string mailto = $"mailto:{recipients}?Subject={"Subject of message"}&Body={body}";
mailto = Uri.EscapeUriString(mailto);
System.Diagnostics.Process.Start(mailto);
```
The Exception that occures: System.ComponentModel.Win32Exception: 'Das System kann die angegebene Datei nicht finden.' (Translated System can not find the file not sure if that is the actuall english error message)
In .NET Core the useshellexecute is set to false while in .NET Framework it's set to true. This is an undocumented breaking change. When porting .NET Framework to .NET Core you have to explicitly use ProcessStartInfo
System.Diagnostics.Process.Start(new ProcessStartInfo(mailto) { UseShellExecute = true });
undocumented
https://docs.microsoft.com/en-us/dotnet/api/system.diagnostics.processstartinfo.useshellexecute
"The default is true on .NET Framework apps and false on .NET Core apps."
undocumented
https://docs.microsoft.com/en-us/dotnet/api/system.diagnostics.processstartinfo.useshellexecute
"The default is true on .NET Framework apps and false on .NET Core apps."
Undocumented in terms of "not mentioned in the 'how to port your framework app to dot net core'" blog posts. In terms of "no red banner in the Process.Start docs". The sentence you quote is not highlighted and only exists in the docs of UseShellExecute.
So yes, its documented. But also yes that it's pretty much unclear for most .NET Framework developers when porting their apps until they experience the issue and hopefully use the search function to figure it out. This is not the first "issue" about it and it will likely not be the last.
Closing, since this seems to be by design.
Most helpful comment
Undocumented in terms of "not mentioned in the 'how to port your framework app to dot net core'" blog posts. In terms of "no red banner in the Process.Start docs". The sentence you quote is not highlighted and only exists in the docs of UseShellExecute.
So yes, its documented. But also yes that it's pretty much unclear for most .NET Framework developers when porting their apps until they experience the issue and hopefully use the search function to figure it out. This is not the first "issue" about it and it will likely not be the last.