Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Win32Exception on System.Diagnostics.Process.Start() in Mono 6.6.0.113 #17204

@erik4711

Description

@erik4711

Steps to Reproduce

  1. Build a .NET Framework project that does
    System.Diagnostics.Process.Start(someFileOrFolderPath)
  2. Run the application in Linux using Mono 6.6.0.113

Current Behavior

When attempting to open a folder:

System.ComponentModel.Win32Exception : Cannot find the specified file

Unhandled Exception:
System.ComponentModel.Win32Exception (0x80004005): Cannot find the specified file
  at System.Diagnostics.Process.StartWithShellExecuteEx (System.Diagnostics.ProcessStartInfo startInfo) [0x00102] in <b5b0f745c94249ea83fff435264d7c59>:0 
  at System.Diagnostics.Process.Start () [0x00032] in <b5b0f745c94249ea83fff435264d7c59>:0 
  at (wrapper remoting-invoke-with-check) System.Diagnostics.Process.Start()
  at System.Diagnostics.Process.Start (System.Diagnostics.ProcessStartInfo startInfo) [0x0001b] in <b5b0f745c94249ea83fff435264d7c59>:0 
  at System.Diagnostics.Process.Start (System.String fileName) [0x00006] in <b5b0f745c94249ea83fff435264d7c59>:0 
  at ConsoleApp1.Program.Main (System.String[] args) [0x0001c] in <47b51f4d614149f3ab22c83af5242dd6>:0 

When attemtping to open a file (for example a text file or image):

System.ComponentModel.Win32Exception : Access denied

Unhandled Exception:
System.ComponentModel.Win32Exception (0x80004005): Access denied
  at System.Diagnostics.Process.StartWithShellExecuteEx (System.Diagnostics.ProcessStartInfo startInfo) [0x00102] in <b5b0f745c94249ea83fff435264d7c59>:0 
  at System.Diagnostics.Process.Start () [0x00032] in <b5b0f745c94249ea83fff435264d7c59>:0 
  at (wrapper remoting-invoke-with-check) System.Diagnostics.Process.Start()
  at System.Diagnostics.Process.Start (System.Diagnostics.ProcessStartInfo startInfo) [0x0001b] in <b5b0f745c94249ea83fff435264d7c59>:0 
  at System.Diagnostics.Process.Start (System.String fileName) [0x00006] in <b5b0f745c94249ea83fff435264d7c59>:0 
  at ConsoleApp1.Program.Main (System.String[] args) [0x0001c] in <af87dece210d42ccab40381983d94652>:0 

Expected Behavior

A folder should be opened in the default file manager (like Thunar) when opening a folder with:
System.Diagnostics.Process.Start(directoryPath)
Files should be opened in their default editors or viewers when attempting to open a file with:
System.Diagnostics.Process.Start(filePath)

System.Diagnostics.Process.Start() works as expected (i.e. the file or folder is opened) in Linux when using Mono 4.6.2 or 5.18.0.240, but throws a Win32Exception when using Mono 6.6.0.113.

On which platforms did you notice this

[ ] macOS
[ X ] Linux
[ ] Windows

Version Used:
Mono JIT compiler version 6.6.0.113 (tarball Sun Oct 6 10:42:20 UTC 2019)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
TLS: __thread
SIGSEGV: altstack
Notifications: epoll
Architecture: amd64
Disabled: none
Misc: softdebug
Interpreter: yes
LLVM: yes(610)
Suspend: hybrid
GC: sgen (concurrent by default)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions