c# - Catching exceptions without a catch block -
i'm working in legacy project (read: refactoring not option) throwing applicationexception
s.
throw new applicationexception(string.format("more 1 type found name {0} in {1}", typename, assemblies));
context
i'm relatively new dev. basic throwing/catching exceptions explicitly makes sense me. concept of exceptions bubbling call stack different catch statement feels intuitive.
beyond know clr capable of.. something. line particularly confusing (from this article)
the exception passed stack until application handles or program terminates.
i cannot find single catch statement in entire solution, leave me think exception terminate process, i'm seeing error message on front end instead - process runs on.
the top of call stack spinning new thread , above external code. show more code if weren't proprietary.
dim installthread new thread(ctype(sub() installpackageasyncinner(appstooverride, package, parameters), threading.threadstart))
the question
is possible thread spun died, , parent thread what's propagating error message , processing exception?
if so, how transfer of control take place in .net
or whatever relevant technology handles it?
if you're throwing exceptions on ui, the call stack has try-catch frame on system.windows.forms.nativewindow.callback
, root of ui thread:
private intptr callback(intptr hwnd, int msg, intptr wparam, intptr lparam) { // note: if change code sure change // corresponding code in debuggablecallback below! message m = message.create(hwnd, msg, wparam, lparam); try { if (weakthisptr.isalive && weakthisptr.target != null) { wndproc(ref m); } else { defwndproc(ref m); } } catch (exception e) { onthreadexception(e); } { if (msg == nativemethods.wm_ncdestroy) releasehandle(false); if (msg == nativemethods.wm_uiunsubclass) releasehandle(true); } return m.result; }
from there, invokes application.threadexception
handler. default handler installed informs of exception. after that, exception swallowed , ui given chance continue running.
Comments
Post a Comment