Bug 32579 - System.Diagnostics.Process.MainModule.FileName does not return full path of the executable and returns 15 chars trimmed value which is same as Process.ProcessName
Summary: System.Diagnostics.Process.MainModule.FileName does not return full path of t...
Alias: None
Product: Class Libraries
Classification: Mono
Component: System (show other bugs)
Version: unspecified
Hardware: PC Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: marcos.henrich
Depends on:
Reported: 2015-07-29 12:33 UTC by Manish Sinha
Modified: 2015-08-14 05:19 UTC (History)
2 users (show)

See Also:
Is this bug a regression?: ---
Last known good build:


Description Manish Sinha 2015-07-29 12:33:22 UTC
Steps to reproduce

Process.GetProcesses ().First ().MainModule.FileName returns the same value as Process.ProcessName which is 15 chars trimmed ProcesName for processes which were not started from command line

> var processes = System.Diagnostics.Process.GetProcesses ();
>foreach (var process in processes) {
>	try {
>		Console.WriteLine (process.MainModule.FileName +"\t"+process.MainModule.FileName.Length);
>	} catch (Exception) {
>	}

> mdworker	8
> Google Chrome H	15
> /Library/Frameworks/Mono.framework/Versions/4.2.0/bin/mono	58
> Google Chrome H	15
> Google Chrome H	15

$ mono --version
Mono JIT compiler version 4.2.0 (explicit/3b17abf Mon Jul 27 15:29:36 EDT 2015)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
	TLS:           normal
	SIGSEGV:       altstack
	Notification:  kqueue
	Architecture:  x86
	Disabled:      none
	Misc:          softdebug 
	LLVM:          yes(3.6.0svn-mono-(no/a173357)
	GC:            sgen
Comment 1 marcos.henrich 2015-08-11 08:38:48 UTC
This issue is fixed by the following pull request:
Comment 2 marcos.henrich 2015-08-14 05:19:18 UTC
Fixed in mono master 6723d1e5cc970ec89c146ceb6f8895db96057919.

Fixed in mono mono-4.2.0-pre2-branch 644d8d657183eb8fd9641a159fec77ce10314b0e

Notice (2018-05-21): bugzilla.xamarin.com will be switching to read-only mode on Thursday, 2018-05-25 22:00 UTC.

Please join us on Visual Studio Developer Community and GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs and copy them to the new locations as needed for follow-up. The See Also field on each Bugzilla bug will be updated with a link to its new location when applicable.

After Bugzilla is read-only, if you have new information to add for a bug that does not yet have a matching issue on Developer Community or GitHub, you can create a follow-up issue in the new location. Copy and paste the title and description from this bug, and then add your new details. You can get a pre-formatted version of the title and description here:

In special cases you might also want the comments:

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Note You need to log in before you can comment on or make changes to this bug.