[UWP]在发布版本中发生异常,Debug构建工作正常 [英] [UWP] Exception occurs in release build, Debug build works fine
问题描述
使用< g class =" gr_ gr_9 gr-alert gr_gramm gr_inline_cards gr_run_anim标点符号only-ins replaceWithoutSep"数据-GR-ID =" 9" ID = QUOT; 9">释放< / g取代;构建应用程序安装。但是当我运行应用程序时,我得到以下
异常。但它在调试版本中工作正常。
$
System.Reflection.MissingMetadataException:Reflection_InsufficientMetadata_NoHelpAvailable:EETypeRva:0x00093618。有关详细信息,请访问http://go.microsoft.com/fwlink/?LinkId=623485
在SharedLibrary!< BaseAddress> + 0x6171de
在SharedLibrary!< BaseAddress> + 0x472787
at System.Reflection.TypeInfo.get_IsVisible()
在CMSWindowsApp!< BaseAddress> + 0x9afe7c
at Newtonsoft.Json.Utilities.DynamicProxyMetaObject< Newtonsoft.Json.Linq.JObject> .BuildCallMethodWithResult(String methodName,Dynamic.DynamicMetaObjectBinder binder,Collections.Generic.IEnumerable< System.Linq.Expressions.Expression>
args, Dynamic.DynamicMetaObject fallbackResult,Json.Utilities.DynamicProxyMetaObject< Newtonsoft.Json.Linq.JObject> .Fallback fallbackInvoke)
at Newtonsoft.Json.Utilities.DynamicProxyMetaObject< Newtonsoft.Json.Linq.JObject> .CallMethodWithResult(String methodName,Dynamic.DynamicMetaObjectBinder binder,Collections.Generic.IEnumerable< System.Linq.Expressions.Expression> args,
Json.Utilities.DynamicProxyMetaObject< Newtonsoft.Json.Linq.JObject> .Fallback fallback,Json.Utilities.DynamicProxyMetaObject< Newtonsoft.Json.Linq.JObject> .Fallback fallbackInvoke)
at Newtonsoft.Json.Utilities.DynamicProxyMetaObject< Newtonsoft.Json.Linq.JObject> .BindGetMember(Dynamic.GetMemberBinder binder)
在System.Dynamic.GetMemberBinder.Bind(Dynamic.DynamicMetaObject target,Dynamic.DynamicMetaObject [] args)
at System.Dynamic.DynamicMetaObjectBinder.Bind(Object [] args,Collections.ObjectModel.ReadOnlyCollection< System.Linq.Expressions.ParameterExpression> parameters,Linq.Expressions.LabelTarget returnLabel)
在SharedLibrary!< BaseAddress> + 0x53c5d2
在SharedLibrary!< BaseAddress> + 0x395594
at System.Func< System.AsyncCallback,System.Object,System.IAsyncResult> .Invoke(AsyncCallback arg1,Object arg2)
在CMSWindowsApp.Screens.URLPage.StoreLocalData(Object resultObj,String url)
在CMSWindowsApp!< BaseAddress> + 0xc0b244
在CMSWindowsApp!< BaseAddress> + 0x9bc3c7
在System.Action< System.Runtime.CompilerServices.CallSite,CMSWindowsApp.Screens.Home,System.Object,CMSWindowsApp.Source.ViewModel.AllAssessmentListViewModel> .Invoke(Runtime.CompilerServices.CallSite arg1,Screens.Home arg2,Object arg3 ,Source.ViewModel.AllAssessmentListViewModel
arg4)
在CMSWindowsApp!< BaseAddress> + 0xeb73e3
如何为发布版本修复此问题?
With the <g class="gr_ gr_9 gr-alert gr_gramm gr_inline_cards gr_run_anim Punctuation only-ins replaceWithoutSep" data-gr-id="9" id="9">release</g> build app get installed. But when I run the app I get the following
exception. But it works fine in the debug build.
System.Reflection.MissingMetadataException: Reflection_InsufficientMetadata_NoHelpAvailable: EETypeRva:0x00093618. For more information, visit http://go.microsoft.com/fwlink/?LinkId=623485
at SharedLibrary!<BaseAddress>+0x6171de
at SharedLibrary!<BaseAddress>+0x472787
at System.Reflection.TypeInfo.get_IsVisible()
at CMSWindowsApp!<BaseAddress>+0x9afe7c
at Newtonsoft.Json.Utilities.DynamicProxyMetaObject<Newtonsoft.Json.Linq.JObject>.BuildCallMethodWithResult(String methodName, Dynamic.DynamicMetaObjectBinder binder, Collections.Generic.IEnumerable<System.Linq.Expressions.Expression>
args, Dynamic.DynamicMetaObject fallbackResult, Json.Utilities.DynamicProxyMetaObject<Newtonsoft.Json.Linq.JObject>.Fallback fallbackInvoke)
at Newtonsoft.Json.Utilities.DynamicProxyMetaObject<Newtonsoft.Json.Linq.JObject>.CallMethodWithResult(String methodName, Dynamic.DynamicMetaObjectBinder binder, Collections.Generic.IEnumerable<System.Linq.Expressions.Expression> args,
Json.Utilities.DynamicProxyMetaObject<Newtonsoft.Json.Linq.JObject>.Fallback fallback, Json.Utilities.DynamicProxyMetaObject<Newtonsoft.Json.Linq.JObject>.Fallback fallbackInvoke)
at Newtonsoft.Json.Utilities.DynamicProxyMetaObject<Newtonsoft.Json.Linq.JObject>.BindGetMember(Dynamic.GetMemberBinder binder)
at System.Dynamic.GetMemberBinder.Bind(Dynamic.DynamicMetaObject target, Dynamic.DynamicMetaObject[] args)
at System.Dynamic.DynamicMetaObjectBinder.Bind(Object[] args, Collections.ObjectModel.ReadOnlyCollection<System.Linq.Expressions.ParameterExpression> parameters, Linq.Expressions.LabelTarget returnLabel)
at SharedLibrary!<BaseAddress>+0x53c5d2
at SharedLibrary!<BaseAddress>+0x395594
at System.Func<System.AsyncCallback,System.Object,System.IAsyncResult>.Invoke(AsyncCallback arg1, Object arg2)
at CMSWindowsApp.Screens.URLPage.StoreLocalData(Object resultObj, String url)
at CMSWindowsApp!<BaseAddress>+0xc0b244
at CMSWindowsApp!<BaseAddress>+0x9bc3c7
at System.Action<System.Runtime.CompilerServices.CallSite,CMSWindowsApp.Screens.Home,System.Object,CMSWindowsApp.Source.ViewModel.AllAssessmentListViewModel>.Invoke(Runtime.CompilerServices.CallSite arg1, Screens.Home arg2, Object arg3, Source.ViewModel.AllAssessmentListViewModel
arg4)
at CMSWindowsApp!<BaseAddress>+0xeb73e3
How do I fix this for the release build?
推荐答案
这与"反射"有关。本文档中提到了这一点: Reflection and .NET Native 。当使用.NET Native的反射时,它将
给出 MissingMetadataException
This is be related to Reflection. This is mentioned in this document here:Reflection and .NET Native. When using reflection with .NET Native, it will give MissingMetadataException
根据您的错误日志,我注意到您可能正在使用Newtonsoft.Json,这也是在提到的文件
此处。
Based on your error log, I noticed that you may be using Newtonsoft.Json which is also mentioned in the document here.
您可以尝试使用不依赖反射的Microsoft序列化器,例如 DataContractSerializer 。
You could try to use Microsoft serializers that do not rely on reflection like DataContractSerializer .
祝你好运,
Roy
这篇关于[UWP]在发布版本中发生异常,Debug构建工作正常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!