2013-10-17 25 views
0

我試圖讓我的方式通過Android的Xamarin Studio MvvmCross示例。 我已經上傳了我的解決方案版本:https://github.com/Krumelur/MvvmCrossTest綁定在Android的MvvmCross測試應用程序不起作用(TargetInvocationException)

我的環境是XS 4.0.13,X.iOS 7.0.2.7,X.Android 4.8.3。所有獨立版。

我試過了Stuart博客文章的版本,但是我無法構建它,因爲它需要Xamarin Business License,因爲它引用了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 

回答

3

具有核心項目爲PCL當在System.Linq.Expressions.Expression一個錯誤,有報道on Xamarin's Bugzilla

您可以按照那裏的指示,使自己的門面組裝或替代,在ViewModel變化RaisePropertyChanged來自:

RaisePropertyChanged(() => this.Foo); 

到:

RaisePropertyChanged("Foo"); 
+0

可以使所有這些變化對你的屬性才具有LINQ的異常彈出別的地方 - 內部mvvmcross視圖模型匹配例如。我會等到他們修復它,或者如您所說,在每次安裝mono.droid的新版本後,使用固定的裝飾替換外觀裝配。 – samneric

0

測試項目在這裏工作第一次

Screenshot

我的詳細信息:

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更新穩定,沒有測試它們針對已知問題:(

要解決此:

  • 你可以回滾到4.8.1
  • 可以用0的代替RaisePropertyChanged(() => Foo)
+0

與通常情況下的財產變更相比:您知道CallerMemberNameAttribute嗎?檢查了這一點:https://gist.github.com/Krumelur/7042686 – Krumelur

+0

我們今天不使用它的原因是http://stackoverflow.com/questions/16463845/searching-for-the-best-pcl-跨平臺發展概況 - 但是wp7的改變即將到來 - 可能會在vs13和xamarin的pcl新聞後發生 – Stuart