【问题标题】:Realm Xamarin.Android Unit Test System.PlatformNotSupportedException领域 Xamarin.Android 单元测试 System.PlatformNotSupportedException
【发布时间】:2017-03-11 16:17:13
【问题描述】:

我正在尝试使用 Xamarin.Android 单元测试项目对我的 Realm (1.1.0) 实现进行单元测试,因为我无法对 PCL 库进行单元测试。

当我调用时

_realm = Realm.GetInstance();

我收到以下错误:

Fail [FAIL] : System.PlatformNotSupportedException : The PCL build of Realm is being linked which probably means you need to use NuGet or otherwise link a platform-specific Realm.dll to your main application.
          at Realms.RealmPCLHelpers.ThrowProxyShouldNeverBeUsed () [0x00000] in <a0bdda658c634b1e932b3ea414073102>:0 
          at Realms.Realm.GetInstance (Realms.RealmConfigurationBase config) [0x00000] in <a0bdda658c634b1e932b3ea414073102>:0 
          at DrifterApps.FeedTheHole.Core.Realms.TestRealmQueries.Setup () [0x00003] in /Users/patrick/Projects/FeedTheHole/Core.Realms.Tests/Realms/TestRealmQueries.cs:17 
          at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
          at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00038] in /Users/builder/data/lanes/3511/77cb8568/source/mono/mcs/class/corlib/System.Reflection/MonoMethod.cs:305 
    Ignore [INFO] : another time

我的项目包括 Realm 库:

<Reference Include="Remotion.Linq">
  <HintPath>..\packages\Remotion.Linq.2.1.1\lib\portable-net45+win+wpa81+wp80\Remotion.Linq.dll</HintPath>
</Reference>
<Reference Include="Realm">
  <HintPath>..\packages\Realm.Database.1.1.0\lib\MonoAndroid44\Realm.dll</HintPath>
</Reference>
<Reference Include="Realm.Sync">
  <HintPath>..\packages\Realm.1.1.0\lib\MonoAndroid44\Realm.Sync.dll</HintPath>
</Reference>
<Reference Include="DotNetCross.Memory.Unsafe">
  <HintPath>..\packages\DotNetCross.Memory.Unsafe.0.2.3.4\lib\netstandard1.0\DotNetCross.Memory.Unsafe.dll</HintPath>
</Reference>

有什么想法吗??

【问题讨论】:

    标签: c# xamarin.android realm


    【解决方案1】:

    Realm 团队在 1.1.1 版本中修复了该问题

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-09-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多