无法评估表达式 - Visual Studio 调试模式 [英] Unable to Evaluate Expression - Visual Studio Debug Mode

查看:42
本文介绍了无法评估表达式 - Visual Studio 调试模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在尝试单步执行代码并使用 Visual Studio 中的立即窗口或监视窗口时,我不断收到以下信息.

I keep getting the following when trying to step through code and use the Immediate Window or Watch Window in Visual Studio.

无法评估表达式

我使用的是 Visual Studio 2008.在论坛上搜索有很多关于使用重载的 Response.Redirect 并将 false 传递给 endResponse 参数的讨论.我试过了

I'm using Visual Studio 2008. Searching the forums there is a lot of talk of using the overloaded Response.Redirect and passing false to the endResponse parameter. I have tried that

我还检查了我的代码运行的是调试版本而不是编译版本.

I have also checked that my code is running the debug version and not the complied version.

我决定启动一个全新的 Windows 窗体应用程序,窗体上没有任何内容.在 Form Load 事件中,我声明了一个 String 并为其设置了一个值.通过断点停在那里,我尝试将字符串的值打印到立即窗口,但我仍然得到无法评估表达式"

I decided to start a brand new Windows Form Application with nothing on the form. In the Form Load event I declare a String and set a value to it. Stopping in there via a breakpoint I try and print the value of the String to the Immediate window and I still get 'Unable to Evaluate the Expression'

这突然发生了.无论我打开任何解决方案,我都无法使用立即窗口或观察窗口来确定代码中的值.

This has occurred all of a sudden. Regardless of any solution I open I am unable to use the Immediate window or watch windows to determine values in the code.

我不确定 Visual Studio 中的设置是否已更改?

I'm not sure If a setting in Visual Studio has changed?

推荐答案

Tools -> Options -> Debugging -> General -> Enable Just My Code

Tools -> Options -> Debugging -> General -> Enable Just My Code

如果未勾选该选项,则会显示无法计算表达式".

If the option is not ticked, then I get "Unable to evaluate the expression".

如果我勾选选项并重新启动visual studio(这是关键点),它会为我解决问题.

If I tick the option AND restart visual studio (this is the crucial bit) it fixes the problem for me.

这篇关于无法评估表达式 - Visual Studio 调试模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆