[Mono-dev] Process.ProcessName acts differently on different platforms (bug or as expected)? [Using "System.Diagnostics.Process.GetCurrentProcess().ProcessName" on different platforms]

R Zaghi rzaghi at mosaic3dx.com
Thu Nov 30 00:39:00 UTC 2017

Hi guys

I have noticed that using
shows different values on different platforms even though the executable
names, paths and command lines and links are exactly identical.

Is this a bug, or expected or nobody cares because it's undefined!?

On a MacOSX this value is Mono's virtual machine executable file name (e.g.
But on Linux/Ubuntu this value the assembly exe filename (e.g.

I felt this should not be the case and tried to find the root cause but
with only a couple of hours in my hand I could only trace it so far - see
Is this worth fixing or is there too much legacy to change a system value
like this !?

I traced it down to "./mono/metadata/w32process.c":
and that seems to be the root of where the calls split into the various
platform specific implementations such as
which is different in:
and in

It might take me several days before I understand all the details but if
someone gives me a pointer I might be able to work this out...

The other matter is about figuring whether we are running a mkbundle
executable or running an assembly directly. I figured using the process
name is perhaps one of the only ways because at least on the OSX this value
is set to the runtime executable rather than my program's name unless if we
have a mkbundle package. But unfortunately this logic breaks due to the
above mis-match in the platform specifics... Any other suggestions!?


Ramin Zaghi

*Mosaic3DX™ | User Interface Technology*
St John's Innovation Centre,
Cowley Road,
*E*: rzaghi at mosaic3dx.com
*T*: +44 1223 421 311
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.dot.net/pipermail/mono-devel-list/attachments/20171130/dcfc7504/attachment.html>

More information about the Mono-devel-list mailing list