C# 4.0 编译器崩溃
此代码示例无法编译。有什么解决办法吗?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
using church = Func<dynamic, dynamic, dynamic>;
class Program
{
static void Main(string[] args)
{
church True = (a, b) => a;
church False = (a, b) => b;
Func<church, church, church> And = (x, y) => x(y(True, False), False);
}
}
}
错误 6 内部编译器错误(地址 5476A4CC 处为 0xc0000005):可能的罪魁祸首是“EMITIL”。编译器中发生内部错误。要解决此问题,请尝试简化或更改下列位置附近的程序。列表顶部的位置更接近发生内部错误的点。可以使用 /errorreport 选项向 Microsoft 报告此类错误。测试应用程序
This code sample is not able to be compiled. Any work arounds out there?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
using church = Func<dynamic, dynamic, dynamic>;
class Program
{
static void Main(string[] args)
{
church True = (a, b) => a;
church False = (a, b) => b;
Func<church, church, church> And = (x, y) => x(y(True, False), False);
}
}
}
Error 6 Internal Compiler Error (0xc0000005 at address 5476A4CC): likely culprit is 'EMITIL'. An internal error has occurred in the compiler. To work around this problem, try simplifying or changing the program near the locations listed below. Locations at the top of the list are closer to the point at which the internal error occurred. Errors such as this can be reported to Microsoft by using the /errorreport option. TestApplication
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
显然这是一个编译器错误。
我向我们的一位测试人员提到了这一点,他说:
对于错误我们深表歉意,并感谢您提请我们注意此问题。
Clearly that is a compiler bug.
I mentioned this to one of our testers and he says:
Apologies for the error, and thanks for bringing this to our attention.
我使用 VS2010 (WinXP 64) 重现了崩溃。
两种解决方法:
1. 不要使用
using
别名以下代码可以在 VS2010 上干净地编译:
2. 使用 Mono 编译器
Mono 2.10 编译器 (dmcs) 没有问题。
这是在linux上测试的。
I reproduced the crash using VS2010 (WinXP 64).
Two workarounds:
1. don't use the
using
aliasThe following code compiles cleanly on VS2010:
2. use the Mono compiler
No problem with Mono 2.10 compiler (dmcs).
This was tested on linux.
编辑:我现在已经成功地重现了它,并且我有一个潜在的解决方法。
这有效:
这不起作用:
所以看起来这是调试信息的问题。如果您在特定场景中可以没有它,那么您就可以开始...
编辑:我刚刚测试过,这也发生在
/debug:pdbonly
中...编辑:以防万一有人想知道,我会联系埃里克·利珀特(Eric Lippert)询问此事。
编辑:这是我现在发现的最小重现:
EDIT: I've now managed to reproduce it, and I have a potential workaround.
This works:
This doesn't:
So it looks like it's a problem with the debug information. If you can live without that in your particular scenario, you're good to go...
EDIT: I've just tested, and this happens with
/debug:pdbonly
as well...EDIT: Just in case anyone was wondering, I'll ping Eric Lippert about this.
EDIT: This is now the minimal repro I've found:
这是另一个解决方法:不要使用
Func
,使用良好的旧委托类型。这还有一个好处,即 Church 可以在任何地方定义,而不仅仅是使用别名作为每个文件。
Here's another workaround: don't use
Func
, use a good old delegate type.This also has the benefit, that Church is defined everywhere, and not just as a per-file using alias.