You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Calling System.Diagnostics.Debugger.Break() should cause the debugger to stop by triggering a user breakpoint at the location where the function was called.
Reproduction Steps
Call Debugger.Break() in small C# console app
Expected behavior
Debugger should stop as if it hit a breakpoint when Debugger.Break() is called
Actual behavior
A System.Runtime.InteropServices.COMException is triggered
Regression?
This is a regression in .NET 9 main builds
Known Workarounds
N/A
Configuration
All OS's and Architectures
Other information
DebuggerUserBreakpoint::IsFrameInDebuggerNamespace is checking the Namespace and the Class by converting a UTF8 string into a Unicode string:
The MAKE_WIDEPTR_FROMUTF8 macro uses ConvertUtf8_Unicode which was re-written in #96099. The original implementation seemed to accept zero-length strings, but the new one will now throw an exception. I am not sure if ConvertUtf8_Unicode intends to support zero length strings (if yes we should consider updating the function). We can work around this particular issue by avoiding converting zero-length strings in DebuggerUserBreakpoint::IsFrameInDebuggerNamespace.
Activity
ghost added
untriagedNew issue has not been triaged by the area owner
I am not sure if ConvertUtf8_Unicode intends to support zero length strings
@AaronRobinsonMSFT@jkotas Do you know if ConvertUtf8_Unicode (and related functions) should accept zero length strings?
For now I have worked around this particular issue by avoiding converting zero-length strings in DebuggerUserBreakpoint::IsFrameInDebuggerNamespace however I am concerned there are other places in the runtime that make the same assumption.
Activity
tommcdon commentedon Jan 21, 2024
@AaronRobinsonMSFT @jkotas Do you know if
ConvertUtf8_Unicode(and related functions) should accept zero length strings?For now I have worked around this particular issue by avoiding converting zero-length strings in
DebuggerUserBreakpoint::IsFrameInDebuggerNamespacehowever I am concerned there are other places in the runtime that make the same assumption.AaronRobinsonMSFT commentedon Jan 21, 2024
I think we might want to revert #96099 for now.
/cc @huoyaoyuan
huoyaoyuan commentedon Jan 21, 2024
Can we add some test to exercise patterns used by debugger?
AaronRobinsonMSFT commentedon Jan 21, 2024
Yep. We'll do that in the updated PR.