Re: Try...Catch across assemblies
- From: Jon Skeet [C# MVP] <skeet@xxxxxxxxx>
- Date: Fri, 1 Jul 2005 07:15:03 +0100
Bryce Covert <BryceCovert@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
<snip>
> With this code, you will get a messagebox showing the error when run from
> VS. You will not from running outside.
Well, the good news is that it's got nothing to do with running in a
different assembly. The bad news is I don't entirely understand it. I
*believe* it's because when you show a dialog, it starts a new message
pump, and *that's* what is popping up the message box. I don't know how
to solve it though. It might be worth asking in the Windows Forms
newsgroup. Here's the code I used to reproduce it in the end in a more
compact (and readable to me, as a C# programmer :) form:
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);
}
}
}
--
Jon Skeet - <skeet@xxxxxxxxx>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
.
- Follow-Ups:
- Re: Try...Catch across assemblies
- From: Mehdi
- Re: Try...Catch across assemblies
- Prev by Date: Re: Displaying Decimals as a string
- Next by Date: http error codes...
- Previous by thread: RE: Problems Before/After Uninstalling .Net Framework 1.1 - Please
- Next by thread: Re: Try...Catch across assemblies
- Index(es):
Relevant Pages
|