我在 .NET Core 2.0 C# 控制台应用程序中使用 Debug.Assert,惊讶地发现它只是在输出窗口中静静地显示“DEBUG ASSERTION FAILS”,而没有中断调试器或根本不显示任何消息框。
如何在 .NET Core 2.0 中恢复这种常见行为?
最佳答案
有一个 GitHub 问题:Debug.Assert(false) does not behave as expected compared to full CLR .
dotnet 团队正在等待更多社区关注:
Designing an appropriate xplat mechanism with the right configuration knobs isn't something I'd want to embark on without more community interest and input.
要恢复这种行为,我们可以像 pm100 那样编写自己的断言。
关于c# - 为什么 Debug.Assert 不会在 .NET Core 中中断或显示消息框?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48413592/