New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Process.Start with ExternalOperationException #8721
Conversation
Codecov Report
@@ Coverage Diff @@
## master #8721 +/- ##
==========================================
+ Coverage 55.71% 55.74% +0.02%
==========================================
Files 900 900
Lines 65096 65076 -20
Branches 11737 11736 -1
==========================================
+ Hits 36270 36278 +8
+ Misses 25995 25967 -28
Partials 2831 2831
Flags with carried forward coverage won't be shown. Click here to find out more. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just questions about try-catch changes
Open, OpenAs are handled in OsShellUtil
@@ -33,7 +48,7 @@ public static void OpenUrlInDefaultBrowser(string url) | |||
{ | |||
if (!string.IsNullOrWhiteSpace(url)) | |||
{ | |||
Process.Start(url); | |||
new Executable(url).Start(useShellExecute: true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This may not work in .NET, despite the docs saying it should, and having it working in .NET Framework, I stumble across it yesterday in fact.
I had to add the verb
option to get it working:
- using var process = new Process
- {
- EnableRaisingEvents = false,
- StartInfo = { FileName = uri.AbsoluteUri }
- };
- process.Start();
+ var ps = new ProcessStartInfo(uri.AbsoluteUri)
+ {
+ UseShellExecute = true,
+ Verb = "open"
+ };
+ Process.Start(ps);
}
}
@msftbot merge in 1 day |
Hello @mstv! Because you've given me some instructions on how to help merge this pull request, I'll be modifying my merge approach. Here's how I understand your requirements for merging this pull request:
If this doesn't seem right to you, you can tell me to cancel these instructions and use the auto-merge policy that has been configured for this repository. Try telling me "forget everything I just told you". |
Contributes to #7795, extracted from #8278
Proposed changes
Executable
forOsShellUtil
implementationOsShellUtil
functions instead of plainProcess.Start
where applicableTest methodology
Test environment(s)
✒️ I contribute this code under The Developer Certificate of Origin.