Visual Studio 2010在不安全块中杀死函数的一个参数中的数据(没有其他词)。 是什么导致了这个错误?调试器显示以下消息。

Cannot obtain value of local or argument as it is not available at this instruction pointer, possibly because it has been optimized away.

当前回答

在visual Studio 2017中 去调试->选项,然后检查调试->通用-> 选中这个选项

其他回答

I found that I had the same problem when I was running a project and debugging by attaching to an IIS process. I also was running in Debug mode with optimizations turned off. While I thought the code compiled fine, when I detached and tried to compile, one of the references was not found. This was due to another developer here that made modifications and changed the location of the reference. The reference did not show up with the alert symbol, so I thought everything was fine until I did the compilation. Once fixing the reference and running again it worked.

在Visual Studio 2017或2015中:

转到解决方案,右键单击解决方案,然后选择属性->选择所有配置->调试,然后单击确定。 在“重新构建并运行”之后,这个解决方案对我来说是有效的。

当我面临同样的问题时,我只需要在重建之前清理我的解决方案。这帮我解决了问题。

转到“项目属性”,在“构建”下确保“优化代码”复选框未选中。

此外,在高级选项(在构建选项卡下)中将“调试信息”下拉菜单设置为“完全”。

在Visual Studio 2012中:

打开项目属性->调试->取消选中“启用Visual Studio托管进程”