What's your configuration? I just ran this code in debug as well as release from the IDE and the command line and it acted as expected.
-----Original Message----- From: Moderated discussion of advanced .NET topics. [mailto:[EMAIL PROTECTED] On Behalf Of Richard Blewett Sent: Wednesday, August 27, 2003 12:35 PM To: [EMAIL PROTECTED] Subject: [ADVANCED-DOTNET] Nasty bug in 1.0 and 1.1 compiler The code below executes both the if and the else in release build with optimization turned on <code> class DisposableClass : IDisposable { public void Dispose() { } } class Class1 { static void Main(string[] args) { try { using ( new DisposableClass() ) { try { if ( args.Length == 0 ) { Console.WriteLine("IN THE IF"); using ( new DisposableClass() ) { } } else { Console.WriteLine("IN THE ELSE"); using ( new DisposableClass() ) { } } } catch ( Exception ) { } } } catch ( Exception ) { } Console.WriteLine("ending called"); } } </code> commenting out the using block in the if block or putting code after the using block in the if resolves the problem Regards Richard Blewett DevelopMentor =================================== This list is hosted by DevelopMentorR http://www.develop.com NEW! ASP.NET courses you may be interested in: 2 Days of ASP.NET, 29 Sept 2003, in Redmond http://www.develop.com/courses/2daspdotnet Guerrilla ASP.NET, 13 Oct 2003, in Boston http://www.develop.com/courses/gaspdotnet View archives and manage your subscription(s) at http://discuss.develop.com =================================== This list is hosted by DevelopMentor� http://www.develop.com NEW! ASP.NET courses you may be interested in: 2 Days of ASP.NET, 29 Sept 2003, in Redmond http://www.develop.com/courses/2daspdotnet Guerrilla ASP.NET, 13 Oct 2003, in Boston http://www.develop.com/courses/gaspdotnet View archives and manage your subscription(s) at http://discuss.develop.com
