Re: Exceptions and WinForms
From: Daniel Moth (dmoth74_at_hotmail.com)
Date: 01/18/05
- Next message: ShieldSoldier: "Re: ActiveSync provider"
- Previous message: Daniel Moth: "Re: C#.net DLL in eVC++"
- In reply to: JohnNorth: "Re: Exceptions and WinForms"
- Next in thread: JohnNorth: "Re: Exceptions and WinForms"
- Reply: JohnNorth: "Re: Exceptions and WinForms"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 18 Jan 2005 12:54:46 -0000
Stepping back and looking at your original question, actually, I'd say that
is expected behaviour. Any exception handling should be done within a form
and not allowed to propagate outside of it (to ShowDialog origin or
otherwise).
So the only thing left to examine is whether there is an incompatibility
with the desktop. Can you try your full framework version of the app built
in Release mode, run from the file system and without VS attached?
Cheers
Daniel
-- http://www.danielmoth.com/Blog/ "JohnNorth" <JohnNorth@discussions.microsoft.com> wrote in message news:F553CCA7-DC4A-4D16-98A2-56F8C5A9A01B@microsoft.com... > Hi Daniel. > No, this happens with and without the debugger. > The full framework works correctly. > > "Daniel Moth" wrote: > >> Does this happen only when you are debugging? In other words, try the >> same >> app that exhibits the problem by manually launching it on the device >> without >> VS attached and see if the dialog stays up with no secondary exception. >> >> Cheers >> Daniel >> -- >> http://www.danielmoth.com/Blog/ >> >> >> "JohnNorth" <JohnNorth@discussions.microsoft.com> wrote in message >> news:EC0D3186-D07F-4F52-9894-4B6271DED15C@microsoft.com... >> > Hi Daniel. >> > Thanks for replying. >> > >> > Below is some example code. >> > >> > private void Form1_KeyPress(object sender, >> > System.Windows.Forms.KeyPressEventArgs e) >> > { >> > >> > Form2 frm2; >> > >> > if(e.KeyChar == 'A' || e.KeyChar =='a' ) >> > { >> > frm2 = new Form2(); >> > >> > try >> > { >> > frm2.ShowDialog(); >> > } >> > catch(Exception) >> > { >> > //MessageBox.Show("Form2 through exception" + Ex.Message); >> > } >> > finally >> > { >> > frm2.Dispose(); >> > frm2=null; >> > >> > } >> > >> > >> > frm2 = new Form2(); >> > >> > try >> > { >> > frm2.ShowDialog(); >> > } >> > finally >> > { >> > frm2.Dispose(); >> > frm2 = null; >> > } >> > } >> > >> > Form2 Key presss event >> > >> > private void Form2_KeyPress(object sender, >> > System.Windows.Forms.KeyPressEventArgs e) >> > { >> > if (e.KeyChar == 'A' || e.KeyChar =='a') >> > throw new Exception("From2 exception"); >> > >> > } >> > >> > >> > "Daniel Moth" wrote: >> > >> >> Do you recreate the form before calling ShowDialog again? Show some >> >> code >> >> >> >> Cheers >> >> Daniel >> >> -- >> >> http://www.danielmoth.com/Blog/ >> >> >> >> >> >> "JohnNorth" <JohnNorth@discussions.microsoft.com> wrote in message >> >> news:5EB2DE6C-F32D-4C97-9B7B-6CAE8F33CB3F@microsoft.com... >> >> > It appears that exception handling outside of a form corrupts >> >> > winforms. >> >> > >> >> > If we have two forms say form1 and form2. On form1 (our start form) >> >> > I've >> >> > put >> >> > a button click event which does a showdialog() for form2. In this >> >> > click >> >> > event >> >> > I've got a try catch around the showdialog method. On form2 I've >> >> > added >> >> > a >> >> > button and a click event which deliberately throws an exception. >> >> > When >> >> > the >> >> > exception is thrown in form2 the code correctly arrives back at the >> >> > catch >> >> > in >> >> > form1. Any subsequent calls to showdialog() then fails with no >> >> > exceptions >> >> > thrown. >> >> > >> >> > Any Ideas >> >> >> >> >> >> >> >>
- Next message: ShieldSoldier: "Re: ActiveSync provider"
- Previous message: Daniel Moth: "Re: C#.net DLL in eVC++"
- In reply to: JohnNorth: "Re: Exceptions and WinForms"
- Next in thread: JohnNorth: "Re: Exceptions and WinForms"
- Reply: JohnNorth: "Re: Exceptions and WinForms"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|