How to debug exception in KernelBase.dll that only occurs with the .NET Native toolchain

2

I'm working on a C# UWP application from a new project I started in Visual Studio this week. It was previously building in release mode fine, but now immediately upon startup i get the exception Exception thrown at 0x75FF4192 (KernelBase.dll) in GhostOverlay.exe: 0x04242420 (parameters: 0x31415927, 0x743C0000, 0x014FEA90). I do not get any expcetions if I start my application in Debug mode - it works fine.

If I continue once, I get

Exception thrown at 0x75FF4192 in GhostOverlay.exe: Microsoft C++ exception: EEFileLoadException at memory location 0x014FD158.

>   vcruntime140_clr0400.dll!__CxxThrowException@8()    Unknown
    clr.dll!EEFileLoadException::Throw(class AssemblySpec *,struct IFusionBindLog *,long,class Exception *) Unknown
    clr.dll!AppDomain::BindAssemblySpec(class AssemblySpec *,int,int,enum StackCrawlMark *,struct AssemblyLoadSecurity *,int)   Unknown
    clr.dll!PEFile::LoadAssembly(unsigned int,struct IMDInternalImport *,char const *,char const *) Unknown
    clr.dll!Module::LoadAssembly(class AppDomain *,unsigned int,char const *,char const *)  Unknown
    clr.dll!Assembly::FindModuleByExportedType(unsigned int,enum Loader::LoadFlag,unsigned int,unsigned int *)  Unknown
    clr.dll!EEClassHashTable::UncompressModuleAndClassDef(void *,enum Loader::LoadFlag,class Module * *,unsigned int *,unsigned int *)  Unknown
    clr.dll!StgPoolReadOnly::GetString(unsigned int,char const * *) Unknown

If I turn off "Mixed (Mangaed and Native)" debugging and use "Managed only" I get just Unhandled exception at 0x75FF4192 (KernelBase.dll) in GhostOverlay.exe: 0xE0434352 (parameters: 0x80070002, 0x00000000, 0x00000000, 0x00000000, 0x743C0000).

I'm a bit out of my depths, being quite new to .NET development, but after a lot of Googling some of these exception codes seem to point to a file not found error? I don't think this comes directly from my code (as it all works fine in Debug mode), but I've even tried deleting all my code, files, and Nuget dependencies, and remaining with just a relatively empty App.xaml / App.xaml.cs, and the error still occurs. As the error happens immediately upon startup, and I don't appear to get any stack trace that points to something in my code, I'm doubtful that I'm missing a file that I'm pointing to within my code.

If I start the app with the cdb debugger, !PrintException returns Could not load file or assembly System.Private.CoreLib, but I'm unsure whether this is a red herring or not, as I've never used cdb before.

cdb output

I Googled this one and most results mentioned loading native or C++ code, which I'm not doing.

I've done countless Cleans, and deleting the bin and obj folders. I've even reinstalled Visual Studio 2019 and the SDKs just to be absolutely certain there's nothing in my install that's causing the issue.

I'm at a loss for what further steps I can take to help debug this issue.

c#
.net
debugging
exception
dll
asked on Stack Overflow Apr 22, 2020 by Josh Hunt • edited Apr 23, 2020 by Josh Hunt

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0