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...
Status: RESOLVED FIXED
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
URL:
Depends on:
Blocks:
 
Reported: 2015-07-29 12:33 UTC by Manish Sinha
Modified: 2015-08-14 05:19 UTC (History)
2 users (show)

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

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

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.


Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

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