首页 > 解决方案 > Xamarin Forms Realm - 无法设置

问题描述

我正在努力让 Realm 工作,但我被卡住了,不知道我做错了什么。

尝试使用此代码连接到 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

标签: xamarinrealm

解决方案


推荐阅读