我正试图通过适用于Android的Xamarin Studio MvvmCross示例。 我已在此处上传了我的解决方案版本:https://github.com/Krumelur/MvvmCrossTest
我的环境是XS 4.0.13,X.iOS 7.0.2.7,X.Android 4.8.3。所有独立版。
我尝试了Stuart博客文章中的版本,但我无法构建它,因为它需要Xamarin商业许可证,因为它引用了System.ServiceModel,所以我无法比较它是否适用于那里。
运行应用程序时,每次在文本字段中输入字符时,我都会得到以下例外情况:
[0:] MvxBind:Error:132.38 SetValue failed with exception - TargetInvocationException: Exception has been thrown by the target of an invocation.
at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0
at System.Reflection.MonoProperty.SetValue (System.Object obj, System.Object value, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] index, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0
at System.Reflection.PropertyInfo.SetValue (System.Object obj, System.Object value, System.Object[] index) [0x00000] in <filename unknown>:0
at Cirrious.MvvmCross.Binding.Bindings.Source.Leaf.MvxLeafPropertyInfoSourceBinding.SetValue (System.Object value) [0x00080] in c:\Projects\Misc\MVVMCROSS\Cirrious\Cirrious.MvvmCross.Binding\Bindings\Source\Leaf\MvxLeafPropertyInfoSourceBinding.cs:86
InnerException was TypeLoadException: Could not load type 'System.Linq.Expressions.Expression' from assembly 'AndroidDemo.Core'.
at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0
at Cirrious.MvvmCross.Binding.Bindings.Source.Leaf.MvxLeafPropertyInfoSourceBinding.SetValue (System.Object value) [0x00080] in c:\Projects\Misc\MVVMCROSS\Cirrious\Cirrious.MvvmCross.Binding\Bindings\Source\Leaf\MvxLeafPropertyInfoSourceBinding.cs:86
InnerException was TypeLoadException: Could not load type 'System.Linq.Expressions.Expression' from assembly 'AndroidDemo.Core'.
at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0
答案 0 :(得分:3)
将核心项目作为PCL并且已报告on Xamarin's Bugzilla时,System.Linq.Expressions.Expression
中存在错误。
您可以按照那里的说明制作自己的外观装配,或者在ViewModel
更改RaisePropertyChanged
之后:
RaisePropertyChanged(() => this.Foo);
为:
RaisePropertyChanged("Foo");
答案 1 :(得分:0)
您的测试项目第一次在这里工作
我的详细信息:
Xamarin Studio
Version 4.0.12 (build 3)
Installation UUID: 683340a3-6ed3-4d10-ba59-9fc326c5ff7c
Runtime:
Mono 3.2.3 ((no/8d3b4b7)
GTK 2.24.20
GTK# (2.12.0.0)
Package version: 302030000
Apple Developer Tools
Xcode 5.0 (3332.25)
Build 5A1413
Xamarin.Mac
Xamarin.Mac: Not Installed
Xamarin.Android
Version: 4.8.1 (Business Edition)
Android SDK: /Users/stuartlodge/Library/Developer/Xamarin/android-sdk-mac_x86
Supported Android versions:
1.6 (API level 4)
2.1 (API level 7)
2.2 (API level 8)
2.3 (API level 10)
3.1 (API level 12)
4.0 (API level 14)
4.0.3 (API level 15)
4.2 (API level 17)
Java SDK: /usr
java version "1.6.0_51"
Java(TM) SE Runtime Environment (build 1.6.0_51-b11-457-11M4509)
Java HotSpot(TM) 64-Bit Server VM (build 20.51-b01-457, mixed mode)
Xamarin.iOS
Version: 7.0.1.4 (Business Edition)
Hash: 4cfca2f
Branch:
Build date: 2013-20-09 23:14:32-0400
Build Information
Release ID: 400120003
Git revision: 593d7acb1cb78ceeeb482d5133cf1fe514467e39
Build date: 2013-08-07 20:30:53+0000
Xamarin addins: 25a0858b281923e666b09259ad4746b774e0a873
Operating System
Mac OS X 10.8.5
Darwin Stuarts-MacBook-Air.local 12.5.0 Darwin Kernel Version 12.5.0
Mon Jul 29 16:33:49 PDT 2013
root:xnu-2050.48.11~1/RELEASE_X86_64 x86_64
鉴于Xamarin以前遇到System.Linq.Expressions.Expression
的问题,或许这是Xamarin.Android 4.8.1和4.8.3之间的问题?
...所以我更新了......
是的,我在4.8.3上看到了同样的问题
所以看起来Xamarin已经将更多的PCL更新发送到了稳定版,而没有针对已知问题进行测试:(
要解决此问题:
RaisePropertyChanged("Foo")
代替RaisePropertyChanged(() => Foo)