Xamarin Forms Realm-无法设置

时间:2018-06-28 11:43:25

标签: xamarin realm

我正在努力使Realm工作正常,但是我被困住了,不知道我在做什么错。

  • 我已经在所有三个项目(共享代码,Android和iOS)中安装了Realm nuget软件包
  • 手动创建具有正确内容的FodyWeavers.xml文件,并将其也复制到Android和iOS项目

在尝试使用以下代码连接到Realm时:

var realm = Realms.GetInstance();

应用程序将崩溃。为什么会这样呢?我已经阅读了3次完整的文档,但似乎找不到我在这里缺少的东西。

感谢帮助

调试输出:

Start App1.Android, HUAWEI WAS-LX1 Player, .
Attempting connection to debug address: 192.168.0.102:37847.
Connected to: 192.168.0.102:37847.
Deploying C:\Users\Matto\source\repos\App1\App1\App1.Android\App1.Android.csproj...
Got device info: HUAWEI WAS-LX1 Player (Android) @ 192.168.0.102:37847
Synchronizing files...
Building and running...
Built with 0 messages.
Deploy to HUAWEI WAS-LX1 Player succeeded.
Unhandled Exception:

System.Reflection.TargetInvocationException: <Timeout exceeded getting exception details>

捕获的异常:

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Reflection.TargetException: Object of type 'NInterpret.InterpretedObject' doesn't match target type 'System.Collections.Generic.List`1[NInterpret.InterpretedObject]'   at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) 
[0x0004f] in <896ad1d315ca4ba7b117efb8dacaedcf>:0    at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters)
[0x00000] in <896ad1d315ca4ba7b117efb8dacaedcf>:0    at NInterpret.Interpreter.callAMethod (NInterpret.AMethod m, NInterpret.AType[] ptypes, NInterpret.AType[] genericMethodArgs, System.Collections.Generic.Dictionary`2[TKey,TValue] genericArgsIndex, System.Object[] args, System.Collections.Generic.List`1[T] byRefArgs, Microsoft.FSharp.Core.FSharpOption`1[T] byRefTarget, System.Object target, System.Boolean virtualCall)
[0x0046a] in <5a7d38ec7eef0f2aa7450383ec387d5a>:0    at NInterpret.Interpreter.callMethodReference (System.Collections.Generic.Dictionary`2[TKey,TValue] gargs, Mono.Cecil.MethodReference ms, System.Boolean virtualCall)
[0x00384] in <5a7d38ec7eef0f2aa7450383ec387d5a>:0    at NInterpret.Interpreter.interpretBlock (System.Object[] args, System.Object[] locals, Mono.Cecil.Cil.Instruction initialInstruction, Microsoft.FSharp.Collections.FSharpSet`1[T] inTries, Microsoft.FSharp.Core.FSharpOption`1[T] lastException)
[0x00fb7] in <5a7d38ec7eef0f2aa7450383ec387d5a>:0    at NInterpret.Interpreter.interpret (System.Object[] args)
[0x00099] in <5a7d38ec7eef0f2aa7450383ec387d5a>:0    at NInterpret.Interpreter.callAMethod (NInterpret.AMethod m, NInterpret.AType[] ptypes, NInterpret.AType[] genericMethodArgs, System.Collections.Generic.Dictionary`2[TKey,TValue] genericArgsIndex, System.Object[] args, System.Collections.Generic.List`1[T] byRefArgs, Microsoft.FSharp.Core.FSharpOption`1[T] byRefTarget, System.Object target, System.Boolean virtualCall)
[0x00184] in <5a7d38ec7eef0f2aa7450383ec387d5a>:0    at NInterpret.Interpreter.callMethodReference (System.Collections.Generic.Dictionary`2[TKey,TValue] gargs, Mono.Cecil.MethodReference ms, System.Boolean virtualCall)
[0x00384] in <5a7d38ec7eef0f2aa7450383ec387d5a>:0    at NInterpret.Interpreter.interpretBlock (System.Object[] args, System.Object[] locals, Mono.Cecil.Cil.Instruction initialInstruction, Microsoft.FSharp.Collections.FSharpSet`1[T] inTries, Microsoft.FSharp.Core.FSharpOption`1[T] lastException)
[0x03c6e] in <5a7d38ec7eef0f2aa7450383ec387d5a>:0    at NInterpret.Interpreter.interpret (System.Object[] args)
[0x00099] in <5a7d38ec7eef0f2aa7450383ec387d5a>:0    at NInterpret.Interpreter.callAMethod (NInterpret.AMethod m, NInterpret.AType[] ptypes, NInterpret.AType[] genericMethodArgs, System.Collections.Generic.Dictionary`2[TKey,TValue] genericArgsIndex, System.Object[] args, System.Collections.Generic.List`1[T] byRefArgs, Microsoft.FSharp.Core.FSharpOption`1[T] byRefTarget, System.Object target, System.Boolean virtualCall)
[0x00184] in <5a7d38ec7eef0f2aa7450383ec387d5a>:0    at NInterpret.Interpreter.callMethodReference (System.Collections.Generic.Dictionary`2[TKey,TValue] gargs, Mono.Cecil.MethodReference ms, System.Boolean virtualCall)
[0x00384] in <5a7d38ec7eef0f2aa7450383ec387d5a>:0    at NInterpret.Interpreter.interpretBlock (System.Object[] args, System.Object[] locals, Mono.Cecil.Cil.Instruction initialInstruction, Microsoft.FSharp.Collections.FSharpSet`1[T] inTries, Microsoft.FSharp.Core.FSharpOption`1[T] lastException)
[0x00fb7] in <5a7d38ec7eef0f2aa7450383ec387d5a>:0    at NInterpret.Interpreter.interpret (System.Object[] args)
[0x00099] in <5a7d38ec7eef0f2aa7450383ec387d5a>:0    at NInterpret.Interpreter.callAMethod (NInterpret.AMethod m, NInterpret.AType[] ptypes, NInterpret.AType[] genericMethodArgs, System.Collections.Generic.Dictionary`2[TKey,TValue] genericArgsIndex, System.Object[] args, System.Collections.Generic.List`1[T] byRefArgs, Microsoft.FSharp.Core.FSharpOption`1[T] byRefTarget, System.Object target, System.Boolean virtualCall)
[0x00184] in <5a7d38ec7eef0f2aa7450383ec387d5a>:0    at NInterpret.Interpreter.NInterpret-IInterpreter-TryCall (System.Object o, NInterpret.InterpretedTypeInfo i, System.String n, System.Type[] p, System.Object[] a, System.Type[] ma)
[0x001b1] in <5a7d38ec7eef0f2aa7450383ec387d5a>:0    at NInterpret.InterpretedDelegate.InterpretDelegate (NInterpret.IInterpreter interp, NInterpret.IInterpretedObject o, NInterpret.InterpretedTypeInfo i, System.String n, System.Type[] p, System.Object[] a)
[0x0001b] in <5a7d38ec7eef0f2aa7450383ec387d5a>:0   at (wrapper dynamic-method) System.Object:lambda_method (System.Runtime.CompilerServices.Closure)   at System.Lazy`1[T].CreateValue ()
[0x00060] in <896ad1d315ca4ba7b117efb8dacaedcf>:0  --- End of stack trace from previous location where exception was thrown ---   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw ()
[0x0000c] in <896ad1d315ca4ba7b117efb8dacaedcf>:0    at System.Lazy`1[T].get_Value ()
[0x00020] in <896ad1d315ca4ba7b117efb8dacaedcf>:0    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) 
[0x00032] in <896ad1d315ca4ba7b117efb8dacaedcf>:0     --- End of inner exception stack trace ---   at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture)
[0x0004b] in <896ad1d315ca4ba7b117efb8dacaedcf>:0    at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters)
[0x00000] in <896ad1d315ca4ba7b117efb8dacaedcf>:0    at NInterpret.Interpreter.callAMethod (NInterpret.AMethod m, NInterpret.AType[] ptypes, NInterpret.AType[] genericMethodArgs, System.Collections.Generic.Dictionary`2[TKey,TValue] genericArgsIndex, System.Object[] args, System.Collections.Generic.List`1[T] byRefArgs, Microsoft.FSharp.Core.FSharpOption`1[T] byRefTarget, System.Object target, System.Boolean virtualCall)
[0x003f7] in <5a7d38ec7eef0f2aa7450383ec387d5a>:0    at NInterpret.Interpreter.callMethodReference (System.Collections.Generic.Dictionary`2[TKey,TValue] gargs, Mono.Cecil.MethodReference ms, System.Boolean virtualCall)
[0x00384] in <5a7d38ec7eef0f2aa7450383ec387d5a>:0    at NInterpret.Interpreter.interpretBlock (System.Object[] args, System.Object[] locals, Mono.Cecil.Cil.Instruction initialInstruction, Microsoft.FSharp.Collections.FSharpSet`1[T] inTries, Microsoft.FSharp.Core.FSharpOption`1[T] lastException)
[0x03c6e] in <5a7d38ec7eef0f2aa7450383ec387d5a>:0    at NInterpret.Interpreter.interpret (System.Object[] args)
[0x00099] in <5a7d38ec7eef0f2aa7450383ec387d5a>:0    at NInterpret.Interpreter.callAMethod (NInterpret.AMethod m, NInterpret.AType[] ptypes, NInterpret.AType[] genericMethodArgs, System.Collections.Generic.Dictionary`2[TKey,TValue] genericArgsIndex, System.Object[] args, System.Collections.Generic.List`1[T] byRefArgs, Microsoft.FSharp.Core.FSharpOption`1[T] byRefTarget, System.Object target, System.Boolean virtualCall)
[0x00184] in <5a7d38ec7eef0f2aa7450383ec387d5a>:0    at NInterpret.Interpreter.callMethodReference (System.Collections.Generic.Dictionary`2[TKey,TValue] gargs, Mono.Cecil.MethodReference ms, System.Boolean virtualCall)
[0x00384] in <5a7d38ec7eef0f2aa7450383ec387d5a>:0    at NInterpret.Interpreter.interpretBlock (System.Object[] args, System.Object[] locals, Mono.Cecil.Cil.Instruction initialInstruction, Microsoft.FSharp.Collections.FSharpSet`1[T] inTries, Microsoft.FSharp.Core.FSharpOption`1[T] lastException)
[0x00fb7] in <5a7d38ec7eef0f2aa7450383ec387d5a>:0    at NInterpret.Interpreter.interpret (System.Object[] args)
[0x00099] in <5a7d38ec7eef0f2aa7450383ec387d5a>:0    at NInterpret.Interpreter.callAMethod (NInterpret.AMethod m, NInterpret.AType[] ptypes, NInterpret.AType[] genericMethodArgs, System.Collections.Generic.Dictionary`2[TKey,TValue] genericArgsIndex, System.Object[] args, System.Collections.Generic.List`1[T] byRefArgs, Microsoft.FSharp.Core.FSharpOption`1[T] byRefTarget, System.Object target, System.Boolean virtualCall)
[0x00184] in <5a7d38ec7eef0f2aa7450383ec387d5a>:0    at NInterpret.Interpreter.callMethodReference (System.Collections.Generic.Dictionary`2[TKey,TValue] gargs, Mono.Cecil.MethodReference ms, System.Boolean virtualCall)
[0x00384] in <5a7d38ec7eef0f2aa7450383ec387d5a>:0    at NInterpret.Interpreter.interpretBlock (System.Object[] args, System.Object[] locals, Mono.Cecil.Cil.Instruction initialInstruction, Microsoft.FSharp.Collections.FSharpSet`1[T] inTries, Microsoft.FSharp.Core.FSharpOption`1[T] lastException)
[0x00fb7] in <5a7d38ec7eef0f2aa7450383ec387d5a>:0    at NInterpret.Interpreter.interpret (System.Object[] args)
[0x00099] in <5a7d38ec7eef0f2aa7450383ec387d5a>:0    at NInterpret.Interpreter.callAMethod (NInterpret.AMethod m, NInterpret.AType[] ptypes, NInterpret.AType[] genericMethodArgs, System.Collections.Generic.Dictionary`2[TKey,TValue] genericArgsIndex, System.Object[] args, System.Collections.Generic.List`1[T] byRefArgs, Microsoft.FSharp.Core.FSharpOption`1[T] byRefTarget, System.Object target, System.Boolean virtualCall)
[0x00184] in <5a7d38ec7eef0f2aa7450383ec387d5a>:0    at NInterpret.Interpreter.callMethodReference (System.Collections.Generic.Dictionary`2[TKey,TValue] gargs, Mono.Cecil.MethodReference ms, System.Boolean virtualCall)
[0x00384] in <5a7d38ec7eef0f2aa7450383ec387d5a>:0    at NInterpret.Interpreter.interpretBlock (System.Object[] args, System.Object[] locals, Mono.Cecil.Cil.Instruction initialInstruction, Microsoft.FSharp.Collections.FSharpSet`1[T] inTries, Microsoft.FSharp.Core.FSharpOption`1[T] lastException)
[0x00fb7] in <5a7d38ec7eef0f2aa7450383ec387d5a>:0    at NInterpret.Interpreter.interpretBlock (System.Object[] args, System.Object[] locals, Mono.Cecil.Cil.Instruction initialInstruction, Microsoft.FSharp.Collections.FSharpSet`1[T] inTries, Microsoft.FSharp.Core.FSharpOption`1[T] lastException)
[0x0013c] in <5a7d38ec7eef0f2aa7450383ec387d5a>:0

0 个答案:

没有答案