“由于当前方法的代码被优化,”无法评估表达式“。意思? [英] What does "Cannot evaluate expression because the code of the current method is optimized." mean?

查看:597
本文介绍了“由于当前方法的代码被优化,”无法评估表达式“。意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写了一些代码,大量的递归,需要相当多的时间才能完成。每当我暂停运行,看看发生了什么:



无法评估表达式,因为



我想我明白这是什么意思。然而,令我困惑的是,在我打了一步之后,代码不再被优化了,我可以看看我的变量。这是如何发生的?

解决方案

调试器使用FuncEval可以让您优化和非优化的代码看变量。 FuncEval需要在GarbageCollector安全点的托管代码中停止线程。手动暂停IDE中的运行会使所有线程尽快停止。您的高递归代码将倾向于停止在不安全的地步。因此,调试器无法评估表达式。



按F10将移至下一个Funceval安全点,并启用功能评估。



有关详细信息,请参阅 FuncEval


I wrote some code with a lot of recursion, that takes quite a bit of time to complete. Whenever I "pause" the run to look at what's going on I get:

Cannot evaluate expression because the code of the current method is optimized.

I think I understand what that means. However, what puzzles me is that after I hit step, the code is not "optimized" anymore, and I can look at my variables. How does this happen? How can the code flip back and forth between optimized and non-optimzed code?

解决方案

The Debugger uses FuncEval to allow you to "look at" variables. FuncEval requires threads to be stopped in managed code at a GarbageCollector safe point. Manually "pausing" the run in the IDE causes all threads to stop as soon as possible. Your highly recursive code will tend to stop at an unsafe point. Hence, the debugger is unable to evaluate expressions.

Pressing F10 will move to the next Funceval Safe point and will enable function evaluation.

For further information review the rules of FuncEval.

这篇关于“由于当前方法的代码被优化,”无法评估表达式“。意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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