Re: Unhandled Exceptions outside of VS
- From: José Manuel Agüero <jmaguero_vodafone.es>
- Date: Tue, 5 Jul 2005 21:41:05 +0200
Hello Bryce,
Exceptions are not propagated to the creator of a Windows Form message pump. You can catch the exception using the Application.ThreadException event:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemWindowsFormsApplicationClassThreadExceptionTopic.asp?frame=true
Regards.
"Bryce Covert" <BryceCovert@xxxxxxxxxxxxxxxxxxxxxxxxx> escribió en el mensaje news:3D1B9182-C2D3-4FEF-9916-BB9EC8A7F934@xxxxxxxxxxxxxxxx
| Some of us on the .net framework were working on an issue that I've
| encountered. It seems that in this code, the catch will not catch the
| exception outside of Visual Studio. If run straight from the exe, it'll
| generate an unhandled exception.
|
| With some more testing, I've noticed this also happens with Application.Run.
|
| Any Ideas?
|
| Thanks!
|
| using System;
| using System.Windows.Forms;
|
| public class Test : Form
| {
| public Test()
| {
| Load += new EventHandler(LoadEventHandler);
| }
|
| private void LoadEventHandler(object sender, EventArgs args)
| {
| throw new Exception("Hello");
| }
|
| static void Main()
| {
| try
| {
| new Test().ShowDialog();
| }
| catch (Exception e)
| {
| Console.WriteLine ("Caught "+e);
| }
| }
| }
.
- References:
- Unhandled Exceptions outside of VS
- From: Bryce Covert
- Unhandled Exceptions outside of VS
- Prev by Date: RichTextBox
- Next by Date: Re: One-touch deployment starts always old version
- Previous by thread: Unhandled Exceptions outside of VS
- Next by thread: "Specified cast is not valid" exception in Updater Application Blo
- Index(es):
Relevant Pages
|