c# - 为什么 Debug.Assert 不会在 .NET Core 中中断或显示消息框?

标签 c# debugging .net-core assert

我在 .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/

相关文章:

c# - 使用 viewmatrix 移动二维对象

c# - 无效的框架标识符 Dotnet 还原、docker 构建

javascript - 通用 Angular2“WeakMap”未定义

c# - 如何创建一个在特定时间自动发送电子邮件的独立程序?

c# - 如何以编程方式判断我是否在 Medium Trust 下运行?

c# - "potentially dangerous Request.Form value"

c# - 此代码会导致托管堆损坏吗?

android - 如何解决 "Warning: debug info can be unavailable. Please close other application using ADB: Restart ADB integration and try again"

debugging - 无法运行 Informix 4GL 交互式调试器

c# - 如何使用 dapper 返回包​​含其他类型列表的类型?