-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Closed
Description
Description
In .NET 10, new IL static variable helpers were added. If the debugger attempts to step through these, the step becomes a go (managed-only behavior) or the step completes at an exception handler (interop debugging behavior).
Reproduction Steps
- Create a new .NET 10 console application and paste the following code:
void MyFunction(Func<int, int> f)
{
int result = f(1);
Console.WriteLine(result);
}
MyFunction(x => x + 1); // breakpoint here
Console.WriteLine("Done. Press any key to continue.");
Console.ReadLine();- Set a breakpoint on the line specified
- Disable Just My Code in Visual Studio
- Launch the program under the debugger and wait for the breakpoint to be hit
- Step in
Expected behavior
Step should land in 'MyFunction'
Actual behavior
When managed-only debugging: the step becomes a go
When interop debugging: Debugger breaks with this stack:
ntdll.dll!ZwWaitForSingleObject() Line 268 Unknown
KernelBase.dll!WaitForSingleObjectEx(void * hHandle, unsigned long dwMilliseconds, int bAlertable) Line 1328 C
ntdll.dll!RtlpCallVectoredHandlers(_EXCEPTION_RECORD * ExceptionRecord, _CONTEXT * ContextRecord, unsigned long Index) Line 204 C
[Inline Frame] ntdll.dll!RtlCallVectoredExceptionHandlers(_EXCEPTION_RECORD *) Line 358 C
ntdll.dll!RtlDispatchException(_EXCEPTION_RECORD * ExceptionRecord, _CONTEXT * ContextRecord) Line 413 C
ntdll.dll!KiUserExceptionDispatch() Line 771 Unknown
[Managed to Native Transition]
CsCon10.dll!Program.<Main>$(string[] args) Line 7 C#
If you look at the ExceptionRecord/ContextRecord, it is breaking at a STATUS_BREAKPOINT with this stack:
[0x0] coreclr!CallDescrWorkerInternal+0x83 0xeacf57dff0 0x7ffa4a464b3c
[0x1] coreclr!DispatchCallDebuggerWrapper+0x1c 0xeacf57e030 0x7ffa4a464bf4
[0x2] coreclr!DispatchCallSimple+0x80 0xeacf57e080 0x7ffa4a464a9e
[0x3] coreclr!StressLog::InlinedStressLogOn+0x5 (Inline Function) (Inline Function)
[0x4] coreclr!StressLog::StressLogOn+0x5 (Inline Function) (Inline Function)
[0x5] coreclr!MethodTable::RunClassInitEx+0x11e 0xeacf57e110 0x7ffa4a465b33
[0x6] coreclr!MethodTable::DoRunClassInitThrowing+0x2f3 0xeacf57e1e0 0x7ffa4a46582f
[0x7] coreclr!MethodTable::CheckRunClassInitThrowing+0x27 (Inline Function) (Inline Function)
[0x8] coreclr!InitClassHelper+0x5f 0xeacf57e770 0x7ffa47b0714f
[0x9] System_Private_CoreLib!System.Runtime.CompilerServices.InitHelpers.InitClassSlow+0x3f 0xeacf57e7b0 0x7ffa47b08908
[0xa] System_Private_CoreLib!System.Runtime.CompilerServices.StaticsHelpers.GetGCStaticBaseSlow+0x18 0xeacf57e880 0x7ff9ea9554e5
Regression?
This is a regression from .NET 9
Known Workarounds
Enable Just My Code
Configuration
This is in .NET 10 preview 3 + x64 Windows. I didn't test other configurations.
Other information
No response