I have a WebAPI application where we often drop various custom dlls into the bin folder for additional functionality. Sometimes the custom dlls reference other custom dlls, which reference other custom dlls... it can be a bit of a nightmare.
Occasionally I will either miss something, or something goes screwy, and I get the infamous YSOD (Yellow Screen Of Death) upon starting the API.
The YSOD will often display the name of the troublemaker assembly, which helps a little, but what I really want to know is the dll(s) that I'm missing. And I know that I can get this information from the LoaderExceptions property if only I could catch and handle the exception!!
I've got a lot of exception handling at a few different levels, including a global exception handler, but after trying quite a few different things, and finding this (so far) unanswered question, I'm getting a nasty suspicion that this exception is occurring in IIS outside of my app, and I have no control over it.
If that IS the case, is there a way I can examine the exception in IIS? Otherwise why would it suggest retrieving the LoaderExceptions?
If NOT the case, how/where/when can I catch and handle this type of exception?
EDIT:
From David's comment below, I have also tried hooking to AppDomain.AssemblyResolve, AppDomain.UnhandledException, and AppDomain.FirstChanceException events, and none of these are catching the yellow screen exception either...