`Debug.Assert` no longer shows a dialog prompt
- Dominant language
- C#
- Stars
- 7.7k
- Forks
- 1.3k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 61
Description
* .NET Core Version: **.NET Core 3.1 onwards**
* Have you experienced this same bug with .NET Framework?: **No**
**Problem description:**
`System.Diagnostics.Trace.Assert` and `System.Diagnostics.Debug.Assert` no longer trigger a dialog prompts in desktop apps. Instead apps silently silently crash unless have a debugger attached.
As discussed in https://github.com/dotnet/runtime/issues/40512, the assert behavior was changed in dotnet/coreclr#20764, and no longer raises a dialog.
https://github.com/dotnet/corefx/blob/master/src/System.Diagnostics.Debug/tests/DebugTestsUsingListeners.cs#L248-L303 illustrates how to implement a custom trace listener, which may act as a basis for a fix.
**Expected behavior:**
No crash, and assertion dialog must appear after assert.
**Minimal repro:**
1. Create new WPF Core project.
2. Put `System.Diagnostics.Debug.Assert(false, "test");` anywhere in the code, for example:
```cs
protected override void OnActivated(EventArgs e)
{
System.Diagnostics.Debug.Assert(false, "test");
}
```
Contributor guide
Assessment
This issue has not been assessed yet.