没有.NET Native编译的错误在发布模式下编译

时间:2017-03-31 14:53:28

标签: c# .net json xamarin

我使用Xamarin.Forms。我使用嵌入的文件data.json作为资源。在Debug in work中,但在使用.NET Native编译时,它会因为一些错误而崩溃。

我被建议使用此https://dotnet.github.io/native/troubleshooter/type.html并更改RD.XML文件。我应该放在哪里摆脱我的错误?我的错误

"System.IO.FileNotFoundException" in System.Private.Reflection.Core.dll
"System.IO.FileNotFoundException" in System.Private.Reflection.Core.dll
"System.AggregateException" in System.Private.Threading.dll
"Microsoft.CSharp.RuntimeBinder.RuntimeBinderException" in Microsoft.CSharp.dll
"System.Reflection.MissingMetadataException" in System.Private.CoreLib.dll
"System.Reflection.TargetInvocationException" in System.Private.CoreLib.dll
"System.Reflection.MissingMetadataException" in System.Linq.Expressions.dll
"System.Reflection.MissingMetadataException" in Newtonsoft.Json.dll
"System.Reflection.MissingMetadataException" in Newtonsoft.Json.dll
"System.Reflection.MissingMetadataException"  Newtonsoft.Json.dll
"System.Reflection.MissingMetadataException" in project.UWP.McgInterop.dll
"System.Reflection.MissingMetadataException"  project.UWP.McgInterop.dll

我的代码

        var assembly = typeof(MyClass).GetTypeInfo().Assembly; 

        Stream stream = assembly.GetManifestResourceStream("project.data.json");

        string text = "";
        using (var reader = new System.IO.StreamReader(stream))
        {
            text = reader.ReadToEnd();
        }
        Levels = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Level>>(text, new MyConverter());

0 个答案:

没有答案