xamarin - Xamarin Forms 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
解决方案
推荐阅读
- elixir - 如何使用 AWS SNS 发送短信 usibng ExAws
- parsing - 一个值中有多个点的 SVG 路径数据
- python - 如何让 discord.py bot 添加 scorpius 符号以及 mod 角色?
- pandas - 打印和存储 t-test 循环的结果
- r - R data.frame colnames 取决于赋值运算符
- c# - 在 mvc 中用网格视图绑定 2 个 sql 表(数据库优先)
- angular - 带有 keydown.space 和 keydown.tab 的角三元条件
- javascript - 从 URL 获取 React-Native JSON
- ios - 如何在 Swift4 中将 UITableView 标签更改为多种颜色
- javascript - 更改组件按钮单击时的 Vue 根实例数据值,然后更改另一个组件的 v-show/v-if