最近开始使用Xamarin和MvvmCross。忙着做我的第一个项目。创建了我的.Core项目和一个ViewModel,在Visual中安装了Nuget包。创建了我的.Droid项目,安装了Nuget包。创建了我的第一个视图,现在尝试运行应用程序。不过,我得到了以下例外:
Could not load type 'System.Runtime.CompilerServices.ExtensionAttribute' from assembly 'Cirrious.MvvmCross.Binding.Droid'.
Full stacktrace:
W/ ( 1438): Missing method .ctor in assembly /data/data/XamTest.Droid/files/.__override__/Cirrious.MvvmCross.Droid.dll, type System.Runtime.CompilerServices.ExtensionAttribute
W/ ( 1438): Can't find custom attr constructor image: /data/data/XamTest.Droid/files/.__override__/Cirrious.MvvmCross.Droid.dll mtoken: 0x0a000012
Unhandled Exception:
System.TypeLoadException:
E/mono ( 1438):
E/mono ( 1438): Unhandled Exception:
E/mono ( 1438): System.TypeLoadException: Could not load type 'System.Runtime.CompilerServices.ExtensionAttribute' from assembly 'Cirrious.MvvmCross.Droid'.
E/mono ( 1438): at XamTest.Droid.SplashScreen..ctor () [0x00000] in c:\Dev\XamTest\XamTest.Droid\SplashScreen.cs:16
E/mono ( 1438): at (wrapper dynamic-method) object.38e61b4f-1913-46a5-ba4a-75980457a823 (intptr,object[]) <IL 0x00018, 0x00053>
E/mono ( 1438): at Java.Interop.TypeManager.n_Activate (intptr,intptr,intptr,intptr,intptr,intptr) [0x0006a] in /Users/builder/data/lanes/monodroid-lion-bigsplash/0e0e51f9/source/monodroid/src/Mono.Android/src/Java.Interop/TypeManager.cs:141
E/mono ( 1438): at (wrapper native-to-managed) Java.Interop.TypeManager.n_Activate (intptr,intptr,intptr,intptr,intptr,intptr) <IL 0x0001e, 0x000a3>
E/mono ( 1438):
I/mono ( 1438): [ERROR] FATAL UNHANDLED EXCEPTION: System.TypeLoadException: Could not load type 'System.Runtime.CompilerServices.ExtensionAttribute' from assembly 'Cirrious.MvvmCross.Droid'.
I/mono ( 1438): at XamTest.Droid.SplashScreen..ctor () [0x00000] in c:\Dev\XamTest\XamTest.Droid\SplashScreen.cs:16
I/mono ( 1438): at (wrapper dynamic-method) object.38e61b4f-1913-46a5-ba4a-75980457a823 (intptr,object[]) <IL 0x00018, 0x00053>
I/mono ( 1438): at Java.Interop.TypeManager.n_Activate (intptr,intptr,intptr,intptr,intptr,intptr) [0x0006a] in /Users/builder/data/lanes/monodroid-lion-bigsplash/0e0e51f9/source/monodroid/src/Mono.Android/src/Java.Interop/TypeManager.cs:141
I/mono ( 1438): at (wrapper native-to-managed) Java.Interop.TypeManager.n_Activate (intptr,intptr,intptr,intptr,intptr,intptr) <IL 0x0001e, 0x000a3>
I/mono ( 1438): 有什么想法吗?
我需要指出的是,当我在Xamarin.Studio中打开我的解决方案时,对核心库的引用显示为一个错误。
(不兼容的目标框架(.Net可移植子集(.Net for Windows,.Net Framework4.5,Silverlight 4,Windows 7.5))。
不过,这可能只是另一个问题,与异常无关。
发布于 2013-10-16 13:11:57
当我遇到同样的问题时,以下是对我有用的东西:
当我更新mvvmCross时,我仍然使用了一个旧版本的Xamarin,它使用了一个旧版本的单机器人。更新Xamarin (新版本使用单机器人3)为我解决了这个问题。
希望这能有所帮助
发布于 2013-09-25 01:20:53
这个问题与我安装的热金枪鱼初学者包的版本有关。我安装了3.0.12版本。
当我将位于packages\MvvmCross.HotTuna.MvvmCrossLibraries.3.0.12\lib\MonoAndroid16的Cirrious.MVVM和Cirrious.MVVM.Droid dll替换为来自热金枪鱼初学者包V3.0.9的dll时,一切都开始正常工作。(我还测试了3.0.4,效果也很好)
我没有测试V3.0.10和v3.0.11。我还测试了v3.0.13测试版,但它仍然是坏的。
发布于 2013-09-25 06:17:50
https://stackoverflow.com/questions/18965330
复制相似问题