Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ private static SafeProcessHandle StartWithShellExecute(ProcessStartInfo startInf
if (verb != string.Empty &&
!string.Equals(verb, "open", StringComparison.OrdinalIgnoreCase))
{
throw new Win32Exception(Interop.Errors.ERROR_NO_ASSOCIATION);
throw new Win32Exception(Interop.Errors.ERROR_NO_ASSOCIATION, SR.Format(SR.UseShellExecuteVerbNotSupported, verb));
}

// On Windows, UseShellExecute of executables and scripts causes those files to be executed.
Expand Down Expand Up @@ -405,7 +405,7 @@ private static SafeProcessHandle StartWithShellExecute(ProcessStartInfo startInf
}

// use default program to open file/url
filename = Process.GetPathToOpenFile() ?? throw new Win32Exception(Interop.Errors.ERROR_NO_ASSOCIATION);
filename = Process.GetPathToOpenFile() ?? throw new Win32Exception(Interop.Errors.ERROR_NO_ASSOCIATION, SR.UseShellExecuteNoOpenProgram);
string[] openFileArgv = ProcessUtils.ParseArgv(startInfo, filename, ignoreArguments: true);

SafeProcessHandle result = ForkAndExecProcess(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -390,4 +390,10 @@
<data name="Argument_InvalidProcessId" xml:space="preserve">
<value>The callback must return a positive process ID for the newly created process.</value>
</data>
<data name="UseShellExecuteVerbNotSupported" xml:space="preserve">
<value>The verb '{0}' is not supported for UseShellExecute on this platform. Only the default verb (an empty string or "open") is supported.</value>
</data>
<data name="UseShellExecuteNoOpenProgram" xml:space="preserve">
<value>No program was found to handle opening files or URLs with UseShellExecute on this platform. Ensure one such as 'xdg-open' or 'open' is installed and available on the PATH.</value>
</data>
</root>