gpt4 book ai didi

visual-studio-2010 - "Cannot evaluate expression..."错误

转载 作者:行者123 更新时间:2023-12-02 09:00:04 25 4
gpt4 key购买 nike

在 Visual Studio 2010 beta 2 中调试应用程序时,突然出现以下错误。

"Cannot evaluate expression because a thread is stopped at a point where garbage collection is impossible, possibly because the code is optimized"

监 window 口中的几乎每个属性或字段都会显示此消息。有谁知道发生了什么事吗?以及如何摆脱它?

项目属性构建选项卡上的“优化代码”复选框已关闭。

最佳答案

这是一个link来讨论这个问题。显然,当函数参数是结构体时,调用该函数所需的堆栈总内存超过了 Visual Studio 调试器 pukes 的某个神奇数字。

报价

I think the sum total sizes of the "references" for all the objects in the struct and the additional parameters on the method was greater than 256 bytes.

I got word back from MS on this issue:

"...generally speaking, when the total size of the arguments passed to a callee function is larger than 256 bytes, JIT will make the caller function partially interruptible. In a partially interruptible code, not every location in the code is a GC safe point. Therefore, it might be unsafe to evaluate expression at certain locations. When this happens you get [the error message]."

So it seems that even since the fields were references, the sum of all them exceeded the 256 byte limit for the debugger.

我也有这个link来自 OpenTK 框架讨论。

报价

I did some digging and it appears that the problem springs from the fact that Math data structures such as Matrix or Vector are of type "struct". C# has a limitation for value types saying that they should not exceed 256 bytes of data when passed as arguments to functions, unless they are passed by reference. Non compliance to that produces uninterruptable code in debug mode. The problem should be solved if the formentioned data structures are transformed from structs to classes.

关于visual-studio-2010 - "Cannot evaluate expression..."错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1961123/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com