diff --git a/src/libraries/System.Diagnostics.Process/src/Microsoft/Win32/SafeHandles/SafeProcessHandle.Unix.cs b/src/libraries/System.Diagnostics.Process/src/Microsoft/Win32/SafeHandles/SafeProcessHandle.Unix.cs index e78f8c8acf8cde..258c5edbc54c8a 100644 --- a/src/libraries/System.Diagnostics.Process/src/Microsoft/Win32/SafeHandles/SafeProcessHandle.Unix.cs +++ b/src/libraries/System.Diagnostics.Process/src/Microsoft/Win32/SafeHandles/SafeProcessHandle.Unix.cs @@ -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. @@ -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( diff --git a/src/libraries/System.Diagnostics.Process/src/Resources/Strings.resx b/src/libraries/System.Diagnostics.Process/src/Resources/Strings.resx index df17778b76ff0a..ee9ffac8b7ab60 100644 --- a/src/libraries/System.Diagnostics.Process/src/Resources/Strings.resx +++ b/src/libraries/System.Diagnostics.Process/src/Resources/Strings.resx @@ -390,4 +390,10 @@ The callback must return a positive process ID for the newly created process. + + The verb '{0}' is not supported for UseShellExecute on this platform. Only the default verb (an empty string or "open") is supported. + + + 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. +