title: C++/CLI: Catching all (.NET/Win32/CRT) exceptions
body: <p>I know this is frowned upon, but I'm out of options here. I'm developing a C++/CLI app that has a bug that I'm unable to track down - mainly because it's bypassing my current crash handler:</p>
  
  <pre><code>AppDomain::CurrentDomain-&gt;UnhandledException += gcnew UnhandledExceptionEventHandler(&amp;LogAndExit);
  Application::ThreadException += gcnew ThreadExceptionEventHandler(&amp;LogAndExit);
  Application::SetUnhandledExceptionMode(UnhandledExceptionMode::CatchException);
  try 
  { 
      Application::Run(gcnew frmMain()); 
  } 
  catch (Exception^ ex) 
  { 
      LogAndExit(ex); 
  } 
  catch (...) 
  { 
      LogAndExit(); 
  }
  </code></pre>
  
  <p>Standard .NET crash handling, I suppose. MSDN reports that some of the CRT exceptions will blow over the managed stack and silently abort the app.</p>
  
  <p>I've been reading up on _set_invalid_parameter_handler, but even though I'm getting a LNK2001 error, it seems it can't be used with /clr:pure. Am I right, or am I just PEBKACing it up and missing a lib file?</p>