Open marius-bughiu opened 5 days ago
Tagging subscribers to this area: @dotnet/area-system-diagnostics-process See info in area-owners.md if you want to be subscribed.
Thoughts on why this might happen / how we could troubleshoot this further?
Since this happens on all of the machines of a certain customer, I would double check for a buggy security monitoring software:
The security monitoring software often intercept Windows OS APIs and make the APIs behave incorrectly. (For example, hang tracked by https://github.com/dotnet/runtime/issues/108144 is a different issue caused by a buggy security software.)
Description
Hi team 👋 , I'm running into the following
ArgumentOutOfRangeException
on all of the machines of a certain customer, when making a simple call to retrieve the current process'SessionId
. For context, we're talking about a .NET 8.0.0 (sdk: 8.0.100) WPF application.The exception occurs when trying to
Slice
theReadOnlySpan
.This is the code triggering the exception:
We cannot debug on the customer's machine, but we were able to capture a memory dump of the process when it crashed. Based on that dump, I've managed to extract the
byte[]
returned byNtQuerySystemInformation
and what happens is:881112
NextEntryOffset
toprocessInformationOffset
we reach an offset of881296
at some point, which is outside the bufferSplice
throws anArgumentOutOfRangeException
I've turned the dotnet code upside down and on all sides, and I cannot figure out a code path on which this could possibly happen.
Interop.NtDll.NtQuerySystemInformation
looks to provide a snapshot in time of the processes, so there should be no overrun due to newly created processes. The only other option is thatInterop.NtDll.NtQuerySystemInformation
returns invalid data._Some other things we've tried:
Thoughts on why this might happen / how we could troubleshoot this further? Any help would be greatly appreciated, thank you!
Reproduction Steps
Expected behavior
No exception is thrown and the correct
SessionId
is returned.Actual behavior
ArgumentOutOfRangeException
is thrown when retrieving theSessionId
.Regression?
On the same machines, a .NET 6 version of the same application works without any issues. Though this might no be very relevant, since we're not able to reproduce this with a .NET 8 console application either.
Known Workarounds
No response
Configuration
Other information
No response