在尝试调试 WCF 服务代码(MSVS2013)时,在“ Addwatch”函数中获取“ Expressionevaluator 中的内部错误”

几天前,我把我的解决方案移到了 MSVS 2013。它工作良好,除了一件事: 当我尝试调试我的 WCF 服务的代码时,它工作,但是当我想观察任何变量的状态时,它说: “表达式计算器中的内部错误”。添加手表功能在客户端正常工作,但在服务代码它破碎。我正在尝试调试在本地主机上运行的自己的 WCF 服务。你能帮我,怎么修理这个吗?

enter image description here

这里 MSVS 信息: MicrosoftVisualStudioProfessional2013 版本12.0.30110.00更新1 微软.NETFramework 版本4.5.51641 操作系统: Windows 8.1

34298 次浏览

This might be a bug in the new (managed) debug engine that ships with Visual Studio 2013. Try turning on 管理兼容模式 (which effectively turns it into pre-2013 debug engine), located under 工具-选项-调试:

如果这解决了问题,那么我建议尝试用一个小项目重现它,然后在 连接上报告它,这样问题就可以得到解决。

@bjhuffine comments below that there are other ways to enable compatibility mode, without globally disabling it (e.g. per-project). More information here: https://devblogs.microsoft.com/devops/switching-to-managed-compatibility-mode-in-visual-studio-2013/

我尝试了 伊加尔的回答,它对我不起作用,但是我找到了一个适合我的解决方案。我清除了手表,并开始再次添加项目。我注意到,如果我试图添加项目不在当前的子或函数,然后一个内部错误发生。

我通过在子函数或函数中添加其他项来解决这个问题,这样就没有错误了。

根据问题 "Internal error in the expression evaluator"’使用管理兼容模式’停止“编辑和继续”。 尝试在 工具-选项-调试下选择“使用遗留的 C # 和 VB 表达式计算器”选项。

Michael Freidgeim's answer helped me debug my issue. But I want to add additional details to the cause of my issue. Only slightly related to asker's question, but his error is extremely misleading.

We were using a Telerik controls RadGrid with GridDateTimeColumn's. The MinDate property on these grids defaults to 01/01/1980 so if you bind a date to this column that is less than that you will see this error. The weird thing is that the original binding and displaying didn't cause a problem, it was only when navigating to another page that the error was thrown.