Here is a piece of code I wrote that fails in running when compiled by MONO. I checked it carefully according to the language specification I have known, and couldn't find any explanation for the failure. I didn't believe it is the final result, and turned to VS to have a try. The program unsurprisingly passed with intended result. And therefore the code is what can distinguish MONO and VS (of the version I am using). The only problem here is whether this distinction is a critical misinterpretation of the language on MONO's side or it's just that I'm using the language feature in an too unconventional and excessive way.
(The following is a simplified test program that can properly demonstrate the problem, Mar.27,2009)
The result by VisualStudio:
: Test 0
: item A generated
: Test 1
: item A generated
请按任意键继续. . .
The result of the program compiled by MONO:
: Test 0
Error:
System.TypeLoadException: “QTest.MonoGenericTest+GEnumerator1`1[T]”上的 Generi
cArguments[0] (“T”)与类型参数“T”的约束冲突。
在 QTest.MonoGenericTest.GEnumerator1`1.<IEnumerable.GetEnumerator>c__Iterato
r0.MoveNext()
在 QTest.MonoGenericTest.Main(String[] args)
: Test 1
: item A generated
As the exception indicates, the MONO runtime framework regards the type parameter passed into GEnumerator (A in this case) from as conflicting with the type constraint (specified by the clause initated with the 'where' keyword). I suspect there is some deficiencies in MONO's runtime type management (as different to C++, C#'s generic types are generally expanded at runtime, this is definitely the reason why there's no error message given out by the compiler)
分享到:
相关推荐
Mono环境winform开发,可在windows操作系统和Linux操作系统下运行,需提前下载Mono部署环境
检查是否安装成功 /Library/Frameworks/Mono.framework/Versions/版本号/bin/mozroots --import —sync 打开.bash_profile添加环境变量 export MONO_HOME=/Library/Frameworks/Mono.framework/Versions/版本号 ...
Microsoft.Net和Mono.Net,并不是“同一个.Net”,它毕竟是“两套不同的.Net”。虽然这两套.Net之间绝大多数特性是可互相兼容、可互相移植的,但依然有一些特性,要么是Microsoft.Net具备而Mono.Net不具备,例如WPF...
在docker的mono镜像中加入一些基本命令包,方便开发(公司内网有些不能下)。有需求的直接下载,同时不需要再到仓库龟速下载了。送上安装命令: docker load -i mono.tar
dnspy的unity相关mono补丁
Reactor教程Mono和Flux例子,同时可以查看我的博客,有介绍如何使用Reactor的详细教程
各种mono API,包含mono for Android API
未能加载文件或程序集“Mono.Security, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756”或它的某一个依赖项。找到的程序集清单定义与程序集引用不匹配。 (异常来自 HRESULT:0x80131040) ...
VINS-Mono详解.pdf
Ubuntu等宽字体Droid Sans Mono Nerd Font Droid Sans Mono Nerd Font Droid Sans Mono Nerd Font
NPgsql及Mono.Security各版本支持文件
MONO下访问eDirectory的动态链接库Mono.Security.dll
Practical Mono(PDF扫描版),目前能找到的唯一的mono的电子书,mono入门与提高的必备书