[Mono-list] exception semantics

Jeroen Frijters mono@jeroen.nu
Tue, 29 Jan 2002 18:13:20 +0100


Once again, I apologise for spreading misinformation. The finally clause
does indeed run in the code below, but only after the just-in-time
debugger popup is dismissed. I failed to notice this. I will now go back
to being a lurker and stop making an ass out of myself ;-)

Regards,
Jeroen

> -----Original Message-----
> From: mono-list-admin@ximian.com 
> [mailto:mono-list-admin@ximian.com] On Behalf Of Jeroen Frijters
> Sent: Tuesday, January 29, 2002 16:04
> To: 'Dwivedi , Ajay Kumar'; mortenolsen@mail.com; 'Jeroen Frijters'
> Cc: mono-list@ximian.com
> Subject: RE: [Mono-list] exception semantics
> 
> 
> You are absolutely right. I apologise for spreading misinformation.
> 
> I was thinking about the following code:
> 		try
> 		{
> 			Console.WriteLine("try");
> 			throw new Exception();
> 		}
> 		catch(Exception x)
> 		{
> 			Console.WriteLine("catch");
> 			throw new Exception();
> 		}
> 		finally
> 		{
> 			Console.WriteLine("finally");
> 		}
> 
> Which does not cause the finally clause to run.
> 
> Regards,
> Jeroen
> 
> > -----Original Message-----
> > From: Dwivedi , Ajay Kumar 
> > [mailto:AjayKumar.Dwivedi@Dresdner-Bank.com] 
> > Sent: Tuesday, January 29, 2002 14:48
> > To: 'mortenolsen@mail.com'; Jeroen Frijters
> > Cc: mono-list@ximian.com
> > Subject: RE: [Mono-list] exception semantics
> > 
> > 
> > This is NOT the correct behaviour.
> > 
> > Tried it with Visual Studio .NET Beta 2
> > Output::
> > In try
> > In catch
> > In finally
> > Press any key to continue
> > 
> > If it were otherwise, it would have defeated the purpose of Finally.
> > 
> > Regards,
> > Ajay
> > 
> > #! If anything can go wrong, FIX it. (To hell with Murphy)
> > Dwivedi, Ajay kumar 
> > 
> > > -----Original Message-----
> > > From: Jeroen Frijters [mailto:mono@jeroen.nu]
> > > Sent: Tuesday, January 29, 2002 4:52 PM
> > > To: mortenolsen@mail.com; mono-list@ximian.com
> > > Subject: RE: [Mono-list] exception semantics
> > > 
> > > 
> > > This is the correct behaviour, since you explicitly 
> return from the
> > > catch block.
> > > 
> > > Regards,
> > > Jeroen
> > > 
> > > > -----Original Message-----
> > > > From: mono-list-admin@ximian.com 
> > > > [mailto:mono-list-admin@ximian.com] On Behalf Of Morten 
> > > Sylvest Olsen
> > > > Sent: Monday, January 28, 2002 21:49
> > > > To: mono-list@ximian.com
> > > > Subject: [Mono-list] exception semantics
> > > > 
> > > > 
> > > > Hi..
> > > > 
> > > > Whats the current state of the interpreter?
> > > > 
> > > > I tried to run the following code (compiled with ms csc.exe):
> > > > 
> > > > ...
> > > > try {
> > > > 	Console.WriteLine("In try");
> > > > 	throw new Exception();
> > > > 	//return(1);
> > > > }
> > > > catch (Exception e) {
> > > > 	Console.WriteLine("In catch");
> > > > 	return(2);
> > > > }
> > > > finally {
> > > > 	Console.WriteLine("In finally");
> > > > }
> > > > 
> > > > and got:
> > > > 
> > > > In try
> > > > In catch
> > > > 
> > > > No execution of the finally block happens.
> > > > 
> > > > Whats the concensus on the exception semantics? I was 
> > > > discussed back in
> > > > August, but I couldn't glean any conclusion whether a 
> > > finally block is
> > > > supposed to be executed before or after the exception handler.
> > > > 
> > > > - Morten
> > > > 
> > > > Novinson's Revolutionary Discovery:
> > > > 	When comes the revolution, things will be different --
> > > > 	not better, just different.
> > > > ----------------------------------------------------------
> > > > email: morten@bergsoe.k-net.dk,c958496@student.dtu.dk
> > > > addresse: Bergsøe Kollegiet v. 1105 2850 Nærum
> > > > ----------------------------------------------------------
> > > > 
> > > > 
> > > > _______________________________________________
> > > > Mono-list maillist  -  Mono-list@ximian.com
> > > > http://lists.ximian.com/mailman/listinfo/mono-list
> > > > 
> > > 
> > > 
> > > _______________________________________________
> > > Mono-list maillist  -  Mono-list@ximian.com
> > > http://lists.ximian.com/mailman/listinfo/mono-list
> > > 
> > 
> 
> 
> _______________________________________________
> Mono-list maillist  -  Mono-list@ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
>