Bug 32579

Summary: 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
Product: [Mono] Class Libraries Reporter: Manish Sinha <masinha>
Component: SystemAssignee: marcos.henrich
Status: RESOLVED FIXED    
Severity: normal CC: marcos.henrich, mono-bugs+mono
Priority: ---    
Version: unspecified   
Target Milestone: Untriaged   
Hardware: PC   
OS: Mac OS   
Tags: 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:
https://github.com/mono/mono/pull/1972
Comment 2 marcos.henrich 2015-08-14 05:19:18 UTC
Fixed in mono master 6723d1e5cc970ec89c146ceb6f8895db96057919.
https://github.com/mono/mono/commit/6723d1e5cc970ec89c146ceb6f8895db96057919

Fixed in mono mono-4.2.0-pre2-branch 644d8d657183eb8fd9641a159fec77ce10314b0e
https://github.com/mono/mono/commit/644d8d657183eb8fd9641a159fec77ce10314b0e