Exception thrown: 'System.Exception' in mscorlib.ni.dll on UWP App Start

和自甴很熟 提交于 2020-01-04 05:50:15

问题


So when I start my UWP application I briefly get a splash screen and then an exception is thrown at:

mscorlib.ni.dll!System.RuntimeTypeHandle.GetTypeByName(string name, bool throwOnError, bool ignoreCase, bool reflectionOnly, ref System.Threading.StackCrawlMark stackMark, System.IntPtr pPrivHostBinder, bool loadTypeFromPartialName) mscorlib.ni.dll!System.RuntimeType.GetType(string typeName, bool throwOnError, bool ignoreCase, bool reflectionOnly, ref System.Threading.StackCrawlMark stackMark) mscorlib.ni.dll!System.Type.GetType(string typeName, bool throwOnError) mscorlib.ni.dll!System.Resources.ResourceManager.GetWinRTResourceManager() mscorlib.ni.dll!System.Globalization.CultureInfo.GetCultureInfoForUserPreferredLanguageInAppX() mscorlib.ni.dll!System.Globalization.CultureInfo.CurrentCulture.get() mscorlib.ni.dll!System.IO.FileLoadException.FormatFileLoadExceptionMessage(string fileName = "System.Runtime, Version=4.0.20.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", int hResult) mscorlib.ni.dll!System.IO.FileNotFoundException.SetMessageField() mscorlib.ni.dll!System.IO.FileNotFoundException.FileNotFoundException(string fileName, string fusionLog, int hResult)

There's no futher details other than "Exception thrown: 'System.Exception' in mscorlib.ni.dll".

Running a different UWP app such as the UWP blank template app works fine but this app specifically seems to have this problem.

I can reproduce the problem with a cut down version of my app that if needed can be downloaded here.


回答1:


So turns out that my App Package was corrupted or something so I deleted the package from [%localappdata%\packages]. You can find the your package name in the package manifest under the packaging section.

I figured this out by looking up the error I was getting in my event viewer which Microsoft's KB said that I should recreate my user account on the machine so that I'd get a new packages folder. But I found that simply deleting your project's package fixes it.



来源:https://stackoverflow.com/questions/37960616/exception-thrown-system-exception-in-mscorlib-ni-dll-on-uwp-app-start

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!