“无法评估表达式,因为当前方法的代码已优化."是什么意思?意思是?

What does quot;Cannot evaluate expression because the code of the current method is optimized.quot; mean?(“无法评估表达式,因为当前方法的代码已优化.是什么意思?意思是?)
本文介绍了“无法评估表达式,因为当前方法的代码已优化."是什么意思?意思是?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我编写了一些包含大量递归的代码,这需要相当长的时间才能完成.每当我暂停"运行以查看发生了什么时,我都会得到:

<块引用><块引用>

无法计算表达式,因为当前方法的代码已经过优化.

我想我明白这意味着什么.然而,令我困惑的是,在我点击 step 之后,代码不再优化",我可以查看我的变量.这是怎么发生的?代码如何在优化代码和非优化代码之间来回翻转?

解决方案

Debugger使用FuncEval让你看"变量.FuncEval 要求在托管代码中的 GarbageCollector 安全点停止线程.手动暂停"IDE 中的运行会导致所有线程尽快停止.您的高度递归代码往往会停在不安全的地方.因此,调试器无法评估表达式.

按 F10 将移动到下一个功能安全点并启用功能评估.

有关详细信息,请查看 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.

这篇关于“无法评估表达式,因为当前方法的代码已优化."是什么意思?意思是?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

DispatcherQueue null when trying to update Ui property in ViewModel(尝试更新ViewModel中的Ui属性时DispatcherQueue为空)
Drawing over all windows on multiple monitors(在多个监视器上绘制所有窗口)
Programmatically show the desktop(以编程方式显示桌面)
c# Generic Setlt;Tgt; implementation to access objects by type(按类型访问对象的C#泛型集实现)
InvalidOperationException When using Context Injection in ASP.Net Core(在ASP.NET核心中使用上下文注入时发生InvalidOperationException)
LINQ many-to-many relationship, how to write a correct WHERE clause?(LINQ多对多关系,如何写一个正确的WHERE子句?)