Skip to content

Add Debugger.Break() to Debug.Assert #15024

Open
@BrennanConroy

Description

@BrennanConroy

Running tests via command line, or running a program (not testing) will crash the process if a Debug.Assert condition fails, and it will pause the debugger if running under one. Both of these behaviors are what I expect and want. However, when running tests via VS testing the Debug.Assert just throws an exception. Which depending on the test could silently pass.

I see #2309 which is when this behavior changed. And while I still think the process should crash when not running under the debugger, I think at a minimum it should break under the debugger so you can see that one of your debug checks is failing.

See https://source.dot.net/#System.Private.CoreLib/src/libraries/System.Private.CoreLib/src/System/Diagnostics/DebugProvider.Unix.cs,18 for example.

Metadata

Metadata

Assignees

No one assigned

    Labels

    futureImprovements which can be done in future and need team triageup-for-grabs

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions