【发布时间】:2021-06-02 02:23:21
【问题描述】:
我正在尝试使用此表达式设置条件断点:
new System.Diagnostics.StakTrace().ToString().Contains("SetupValidity")
但它总是出错:
The following breakpoint cannot be set:
(redacted) when 'new System.Diagnostics.StakTrace().ToString().Contains("SetupValidity")' is true
The condition for a breakpoint failed to execute.
The condition was 'new System.Diagnostics.StakTrace().ToString().Contains("SetupValidity")'.
The error returned was 'Evaluation of method System.Diagnostics.StackTrace.ToString requires calling method
System.Reflection.MethodBase.get_MethodImplementationFlags, which cannot be called in this context.'
四处搜索,我发现了两个建议:
- 检查(并重新启动 VS)
Tools -> Options -> Debugging -> Use Managed Compatibility Mode - 检查(在项目属性中)
Enable native code debugging
尝试分别同时启用这些功能.. 没有变化。
工具:
.NET Core 3.1Microsoft Visual Studio Community 2019 16.8.5
我该如何解决这个问题?
【问题讨论】:
标签: c# visual-studio debugging .net-core