.NET编译器限制添加?

前端之家收集整理的这篇文章主要介绍了.NET编译器限制添加?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我的同事和我刚刚发现vb.net代码中可以使用的参数数量似乎有限制.

对我来说很奇怪的是,这个代码将构建,但是当我运行它时,它会抛出一个InvalidProgramException,说“JIT编译器遇到内部限制”.

以前有人见过这样的事吗?你能指出我为什么会这样吗?

(我在VS 2010中使用.net 4.0.我们在VS 2008中发现了这一点,结果略有不同.)

示例代码

Dim bigVariable As Double = 10.35
    Dim factor As Double = 1.3
    Dim hugeNumberOfArgs As Double = (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) +
(bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor) + (bigVariable * factor)

        Console.WriteLine("Result: " & hugeNumberOfArgs)
        Console.ReadKey()
经过进一步调查后,我不认为这是编译器问题.代码在Debug中崩溃,在Retail中运行良好.我已经对IL进行了几次差异化,并且不会遇到可辨别的差异.

这也是C#中的错误修饰.如果您正在尝试重新编写此项,请确保将调试传递给命令行编译器.

这似乎是JIT编译中的一个错误.防止调试模式崩溃的一种方法添加以下代码

<Assembly: Debuggable(DebuggableAttribute.DebuggingModes.DisableOptimizations)>

添加后,代码将成功执行.这种和两种语言的重新强烈表明它是JIT过程中的一个错误.

原文链接:https://www.f2er.com/vb/255017.html

猜你在找的VB相关文章