New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linux: System.Diagnostics.Process.GetProcesses can throw if reading from /proc for any process fails #12834

gregg-miskelly opened this Issue Oct 20, 2016 · 2 comments


None yet
4 participants

gregg-miskelly commented Oct 20, 2016


This issue was initially reported by @robvanpamel on OmniSharp/omnisharp-vscode#808.

Environment data

dotnet --info output:

.NET Command Line Tools (1.0.0-preview2-003131)

Product Information:
 Version:            1.0.0-preview2-003131
 Commit SHA-1 hash:  635cf40e58

Runtime Environment:
 OS Name:     ubuntu
 OS Version:  16.04
 OS Platform: Linux
 RID:         ubuntu.16.04-x64


This issue came @robvanpamel having problems with dotnet test when invoked by OmniSharp. From inspecting the code, this looks to be the problem:

  1. dotnet test is calling System.Diagnostics.Process.GetProcesses(), and then it is going to filter that to a process that it care about
  2. System.Diagnostics.Process.GetProcesses finds a process, and it tries to read its stat file
  3. This throws (because the process is exiting???) and that breaks the process listing completely

Call stack

dotnet-test Error: 0 : System.IO.InvalidDataException: Found invalid data while decoding.
at System.IO.StringParser.ParseNextChar()
at Interop.procfs.TryParseStatFile(String statFilePath, ParsedStat& result, ReusableTextReader reusableReader)
at System.Diagnostics.ProcessManager.CreateProcessInfo(ParsedStat procFsStat, ReusableTextReader reusableReader)
at System.Diagnostics.ProcessManager.CreateProcessInfo(Int32 pid, ReusableTextReader reusableReader)
at System.Diagnostics.ProcessManager.GetProcessInfos(String machineName)
at System.Diagnostics.Process.GetProcesses(String machineName)
at System.Diagnostics.Process.GetProcesses()
at Microsoft.DotNet.Tools.Test.TestCommand.RegisterForParentProcessExit(Int32 id)
at Microsoft.DotNet.Tools.Test.TestCommand.DoRun(String[] args)


This comment has been minimized.

Show comment
Hide comment

svick Oct 20, 2016


This sounds very similar to #12755.


svick commented Oct 20, 2016

This sounds very similar to #12755.


This comment has been minimized.

Show comment
Hide comment

stephentoub Oct 20, 2016


I believe this is the same as #12755, for which a fix was already merged.


stephentoub commented Oct 20, 2016

I believe this is the same as #12755, for which a fix was already merged.

@karelz karelz modified the milestone: 1.2.0 Dec 3, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment