0

我正在尝试通过适用于 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 
4

2 回答 2

3

将 Core 项目作为 PCL 时存在错误,System.Linq.Expressions.Expression并且已在 Xamarin 的 Bugzilla 上报告。

您可以按照那里的说明制作自己的外观组件,或者在您的ViewModel更改中RaisePropertyChanged

RaisePropertyChanged(() => this.Foo);

到:

RaisePropertyChanged("Foo");
于 2013-10-17T21:32:07.370 回答
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 更新发布到了稳定版,而没有针对已知问题进行测试:(

要解决此问题:

  • 你可以回滚到 4.8.1
  • 你可以使用RaisePropertyChanged("Foo")而不是RaisePropertyChanged(() => Foo)
于 2013-10-18T08:44:46.373 回答