Note that there are some explanatory texts on larger screens.

plurals
  1. POHandling Error "WebDev.WebServer.Exe has stopped working"
    primarykey
    data
    text
    <p>Is there a way to handle the error "WebDev.WebServer.Exe has stopped working" in ASP.NET and keep the page running or even the just the WebServer running? Or is this an impossible task and is essentially like asking how to save someone's life after they've died?</p> <p>I have the error-causing code inside a try/catch block, but that doesn't make a difference. I've also tried registering a new UnhandledExceptionEventHandler, but that didn't work either. My code is below in case I'm doing something wrong.</p> <p>Also to be clear, I'm not asking for help on how to prevent the error; I want to know if and when the error happens if there's anything I can do to handle it.</p> <p>UPDATE 1: TestOcx is a VB6 OCX that passes a reference of a string to a DLL written in <a href="http://en.wikipedia.org/wiki/Clarion_(programming_language)" rel="nofollow noreferrer">Clarion</a>.</p> <p>UPDATE 2: As per @JDennis's answer, I should clarify that the <code>catch(Exception ex)</code> block is not being entered either. If I removed the call to the OCX from the <code>try\catch</code> block it still won't reach the <code>UnhandledException</code> method. There are essentially two areas that don't ever get executed.</p> <p>UPDATE 3: From @AndrewLewis, I tried to also add a regular <code>catch</code> block to catch any non-CLS compliant exceptions, and this did not work either. However, I later found that since .NET 2.0 on, all non-CLS exceptions are wrapped inside <code>RuntimeWrappedException</code> so a <code>catch (Exception)</code> will catch non-CLS compliant exceptions too. Check out <a href="https://stackoverflow.com/questions/1531077/will-clr-handle-both-cls-complaint-and-non-cls-complaint-exceptions">this other question here</a> for more info.</p> <pre><code>public bool TestMethod() { AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); string input = "test"; string result = ""; try { TestOcx myCom = new TestOcx(); result = myCom.PassString(ref input); // &lt;== MAJOR ERROR! // do stuff with result... return true; } catch (Exception ex) { log.Add("Exception: " + ex.Message); // THIS NEVER GETS CALLED return false; } } private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) { // THIS NEVER GETS CALLED try { Exception ex = (Exception)e.ExceptionObject; log.Add("Exception: " + ex.Message); } catch (Exception exc) { log.Add("Fatal Non-UI Error: " + exc.Message); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload