Bug 44328 - MainModule.FileVersionInfo.FileName reports different paths based on lookup timing
Summary: MainModule.FileVersionInfo.FileName reports different paths based on lookup t...
Status: NEW
Alias: None
Product: Runtime
Classification: Mono
Component: io-layer (show other bugs)
Version: 4.4.2 (C7SR1)
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2016-09-14 21:10 UTC by christopher dieringer
Modified: 2016-09-16 13:53 UTC (History)
3 users (show)

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


Description christopher dieringer 2016-09-14 21:10:35 UTC

if I run a child process and grab the FileName for it, depending on _when_ I ask for the FileName, I am subject to get different results.

Here's a snapshot of a very basic repo where one can replicate the issue: https://gitlab.com/cdaringe/csharp-manage-child-process-demo/tree/8b605cef1d74fa38c04f7c6ea216f842848717de

To reproduce:

- follow the readme instructions (very basic!)
- install the c# project's packages (just json.net)
- run the app.  at this point https://gitlab.com/cdaringe/csharp-manage-child-process-demo/blob/8b605cef1d74fa38c04f7c6ea216f842848717de/ChildProcessHandles/Program.cs#L120 if you are running on OSX you will observe the that filename == '/usr/bin/env'.
  - this is _not_ the binary that was called
- stop execution
- uncomment the following and rebuild: https://gitlab.com/cdaringe/csharp-manage-child-process-demo/blob/8b605cef1d74fa38c04f7c6ea216f842848717de/ChildProcessHandles/Program.cs#L77
- at the previous point of error, the filename is now correctly `/some/path/node`, per expectation


OS: mac osx 10.11
mono: Mono JIT compiler version 4.4.2 (mono-4.4.0-branch-c7sr1/f72fe45 Wed Jul 27 16:20:13 EDT 2016)
Comment 1 christopher dieringer 2016-09-14 21:53:11 UTC
on windows, using .net proper, it also actually reports out cmd.exe in _both_ scenarios.  not sure what to pick to reliably get the path to the running binary and the args it was provided, if they are even available. :/

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