-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
System.Diagnostics.Process.ProcessName returning incorrect information on Linux with .NET 5 #33673
Comments
@SteveL-MSFT do you have some info on how to reproduce this?
Program.cs:
outputs:
using:
|
So in PowerShell, the code is calling |
also outputs:
|
Let me investigate this a bit after my meeting, wrote a simple C# program and it doesn't repro. The only change on the PowerShell side was moving from .NET Core 3.1 to .NET 5 preview.1 |
@tmds, ok, the problem is when Thread.CurrentThread.Name is set, then the process name uses that:
|
In dotnet/coreclr#27182 support was added for naming Linux threads. The name set for the main thread shows up in the Previously changing the thread name was a no-op. |
@tmds I agree. |
Seems reasonable, @tmds. Might be a good idea to also mention in the docs that in some platforms the name might be truncated due to platform limitations (as mentioned by @SteveL-MSFT) to avoid surprises. Although, to determine the |
I'll make a PR for this change.
I was not aware of this API. We want to get this info for any process on the system. This is available in |
… Linux Fixes dotnet/runtime#33673 This issue is a side-effect of adding support for setting thread names on Linux in dotnet/coreclr#27182. cc @janvorli @lpereira @SteveL-MSFT
… Linux (#34064) Fixes #33673 This issue is a side-effect of adding support for setting thread names on Linux in dotnet/coreclr#27182. Co-authored-by: Dan Moseley <danmose@microsoft.com> Co-authored-by: Aleksey Kliger (λgeek) <akliger@gmail.com>
Moving PowerShell to .NET 5 via branch https://github.com/SteveL-MSFT/PowerShell/tree/dotnet-5
We have tests that expect the
pwsh
process to have a ProcessName ofpwsh
, but on Linux, the name is actuallyConsoleHost mai
(looks to be cut off). Works correctly on Windows and macOS.Note that
[System.AppDomain]::CurrentDomain.FriendlyName
returnspwsh
as expected.The text was updated successfully, but these errors were encountered: