Click here to Skip to main content
15,908,444 members
Home / Discussions / C#
   

C#

 
GeneralRe: Unhandled exceptions on Model Form remains unhandled in the release build even if the call to the model form is wrapped up in the try….catch{ } block!!!!!! Pin
Christian Graus4-Aug-09 23:46
protectorChristian Graus4-Aug-09 23:46 
GeneralRe: Unhandled exceptions on Model Form remains unhandled in the release build even if the call to the model form is wrapped up in the try….catch{ } block!!!!!! Pin
Cracked-Down5-Aug-09 0:05
Cracked-Down5-Aug-09 0:05 
GeneralRe: Unhandled exceptions on Model Form remains unhandled in the release build even if the call to the model form is wrapped up in the try….catch{ } block!!!!!! Pin
Christian Graus5-Aug-09 0:17
protectorChristian Graus5-Aug-09 0:17 
AnswerRe: Unhandled exceptions on Model Form remains unhandled in the release build even if the call to the model form is wrapped up in the try….catch{ } block!!!!!! Pin
Moreno Airoldi5-Aug-09 0:48
Moreno Airoldi5-Aug-09 0:48 
GeneralRe: Unhandled exceptions on Model Form remains unhandled in the release build even if the call to the model form is wrapped up in the try….catch{ } block!!!!!! Pin
Cracked-Down5-Aug-09 1:03
Cracked-Down5-Aug-09 1:03 
GeneralRe: Unhandled exceptions on Model Form remains unhandled in the release build even if the call to the model form is wrapped up in the try….catch{ } block!!!!!! Pin
Moreno Airoldi5-Aug-09 2:44
Moreno Airoldi5-Aug-09 2:44 
GeneralRe: Unhandled exceptions on Model Form remains unhandled in the release build even if the call to the model form is wrapped up in the try….catch{ } block!!!!!! Pin
Cracked-Down5-Aug-09 18:45
Cracked-Down5-Aug-09 18:45 
GeneralRe: Unhandled exceptions on Model Form remains unhandled in the release build even if the call to the model form is wrapped up in the try….catch{ } block!!!!!! Pin
Moreno Airoldi5-Aug-09 23:19
Moreno Airoldi5-Aug-09 23:19 
As I said, it happens because of the debugger. The debugger contains an exception handler which "watches" for exceptions while running the code. When an exception is caught, it will walk up not only the function call stack (which is what the runtime does when you run the exe), but the program flow - searching for a try/catch block which can catch the exception. If it's not found, then the debugger's handler kicks in (it's the piece of code that shows you the exception message box and lets you point at the code which raised it).

Now, calling ShowDialog() is not like calling any other function. A normal function call will just transfer the current thread's execution to the function's code, saving the return address on the stack, and return to the calling code when the function exits. This allows for the raised exception to be passed directly up to the calling code and get caught by the upper level try/catch block.

What happens when you call ShowDialog() is that the new form is created and shown, and the UI's message pump (remember it all runs on a single thread, but it's message-based) starts managing it together with all other open forms, with the only exception that other forms will be "frozen". When the dialog closes and returns its result, this is passed back to the calling code, and execution flow returns there, but in this case exceptions do not cross the boundaries of forms, since there's no "bridging" code for that to happen.

This is the best explanation I can give, I hope it clears your doubts. Maybe some other guy can give a more complete or deeper explanation. Smile | :)

2+2=5 for very large amounts of 2
(always loved that one hehe!)

GeneralRe: Unhandled exceptions on Model Form remains unhandled in the release build even if the call to the model form is wrapped up in the try….catch{ } block!!!!!! Pin
Cracked-Down6-Aug-09 0:20
Cracked-Down6-Aug-09 0:20 
GeneralRe: Unhandled exceptions on Model Form remains unhandled in the release build even if the call to the model form is wrapped up in the try….catch{ } block!!!!!! Pin
Moreno Airoldi6-Aug-09 0:26
Moreno Airoldi6-Aug-09 0:26 
Question"NC code" text file parsing with C# Pin
kirazercan4-Aug-09 22:14
kirazercan4-Aug-09 22:14 
AnswerRe: "NC code" text file parsing with C# Pin
Christian Graus4-Aug-09 22:25
protectorChristian Graus4-Aug-09 22:25 
Question[Message Deleted] Pin
engg_sukreet4-Aug-09 22:08
engg_sukreet4-Aug-09 22:08 
AnswerRe: hi Pin
Christian Graus4-Aug-09 22:13
protectorChristian Graus4-Aug-09 22:13 
AnswerRe: hi Pin
OriginalGriff4-Aug-09 22:16
mveOriginalGriff4-Aug-09 22:16 
AnswerRe: hi Pin
stancrm4-Aug-09 22:55
stancrm4-Aug-09 22:55 
GeneralRe: hi Pin
tomseyes4-Aug-09 23:13
tomseyes4-Aug-09 23:13 
Question[Message Deleted] Pin
engg_sukreet4-Aug-09 22:05
engg_sukreet4-Aug-09 22:05 
AnswerRe: Hello Guys Pin
Christian Graus4-Aug-09 22:14
protectorChristian Graus4-Aug-09 22:14 
AnswerRe: Hello Guys Pin
stancrm4-Aug-09 22:54
stancrm4-Aug-09 22:54 
GeneralRe: Hello Guys Pin
OriginalGriff4-Aug-09 22:57
mveOriginalGriff4-Aug-09 22:57 
GeneralRe: Hello Guys Pin
Mycroft Holmes4-Aug-09 23:18
professionalMycroft Holmes4-Aug-09 23:18 
GeneralRe: Hello Guys Pin
Amangang5-Aug-09 2:21
Amangang5-Aug-09 2:21 
AnswerRe: Wat kind of idiot am I? Pin
OriginalGriff5-Aug-09 2:29
mveOriginalGriff5-Aug-09 2:29 
GeneralRe: Wat kind of idiot am I? Pin
Amangang5-Aug-09 3:34
Amangang5-Aug-09 3:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.