异常引发:在UWP应用程序启动的mscorlib.ni.dll中的'System.Exception'

问题描述:

所以当我开始我的UWP应用程序时,我简要地得到一个启动屏幕,然后抛出异常:

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)

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)

除了exception throwed:'System.Exception'in mscorlib.ni.dll。

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

运行不同的UWP应用程序,如UWP空白模板应用程序工作正常,但这个应用程序专门似乎有这个问题。

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.

所以证明我的应用程序包损坏了,所以我从[%localappdata%\packages]中删除了该包。您可以在包装部分的包装清单中找到您的包名。

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.