C#4.0编译器崩溃 [英] C# 4.0 Compiler Crash
问题描述
此代码示例是不能够被编译。 ?任何变通那里
使用系统;
使用System.Collections.Generic;
使用System.Linq的;
使用System.Text;
命名ConsoleApplication1
{
使用的教会= Func键<动态,动态,动态取代;
类节目
{
静态无效的主要(字串[] args)
{
教会真=(A,B)=>一个;
教堂假=(A,B)=> b:
Func键<教堂,教堂,教堂>和=(X,Y)=> X(Y(真,假),FALSE);
}
}
}
的错误6内部编译器错误的(0000005地址5476A4CC):可能的罪魁祸首是EMITIL。已经编译器中发生内部错误。要解决此问题,请尝试简化或改变近以下地点的计划。在列表的顶端位置更接近在发生该内部错误的点。错误,例如,这可以通过使用/ errorreport选项报告给微软。 TestApplication
块引用>
解决方案我转载使用VS2010(WinXP的64)。崩溃
两种解决方法:
1。不要使用
使用
别名
下面的代码完全编译上VS2010:
使用系统;
使用System.Collections.Generic;
使用System.Linq的;
使用System.Text;
命名ConsoleApplication1
{
类节目
{
静态无效的主要(字串[] args)
{
Func键<动态,动态,动态>真=(A,B)=>一个;
Func键<动态,动态,动态>假=(A,B)=> b:
Func键< Func键<动态,动态,动态>中
Func键<动态,动态,动态>中
Func键<动态,动态,动态> >和
=(X,Y)=> X(Y(真,假),FALSE);
}
}
}
2。使用单声道编译
没有使用Mono 2.10编译器(公契)的问题。
[单] / tmp目录@契test.cs中
test.cs中(18,42):警告CS0219:变量'和'被分配但其值从未使用
编译成功了 - 1个警告
[单] / tmp目录@ ./test.exe
[单] / tmp目录@
这是在Linux上进行测试。
- 您可以运行在Windows .NET创建单一的二进制文件。
- 单声道编译器都带有一个安装MSI并在Windows上运行也是如此。
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
解决方案I reproduced the crash using VS2010 (WinXP 64).
Two workarounds:
1. don't use the
using
aliasThe following code compiles cleanly on VS2010:
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { Func<dynamic, dynamic, dynamic> True = (a, b) => a; Func<dynamic, dynamic, dynamic> False = (a, b) => b; Func<Func<dynamic, dynamic, dynamic>, Func<dynamic, dynamic, dynamic>, Func<dynamic, dynamic, dynamic> > And = (x, y) => x(y(True, False), False); } } }
2. use the Mono compiler
No problem with Mono 2.10 compiler (dmcs).
[mono] /tmp @ dmcs test.cs test.cs(18,42): warning CS0219: The variable `And' is assigned but its value is never used Compilation succeeded - 1 warning(s) [mono] /tmp @ ./test.exe [mono] /tmp @
This was tested on linux.
- You can run binaries created with mono on Windows .NET.
- Mono compiler comes with an installer MSI and runs on Windows as well.
这篇关于C#4.0编译器崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!