I believe the point is a little bit more subtle, if it fails with this
simple construct can you guarantee that it doesn't fail with more
complex constructs that can affect production code to perform
unexpectedly.

-----Original Message-----
From: J. Merrill [mailto:[EMAIL PROTECTED] 
Sent: Friday, 29 August 2003 2:52 AM
To: [EMAIL PROTECTED]
Subject: Re: [ADVANCED-DOTNET] Nasty bug in 1.0 and 1.1 compiler

Ouch.  That's actually more serious than the original -- I would not
have imagined anyone needing (or thinking) to write a "using" statement
with an empty body.  When would that bee necessary (or even useful)?

In this code, do you need both the TRY and FINALLY blocks to be empty to
see the bug?  That's also not a likely real-world construct, is it?

At 06:18 AM 8/28/2003 -0400, Richard Blewett wrote
>On Thu, 28 Aug 2003 03:53:19 -0400, Vijay M <[EMAIL PROTECTED]> wrote:
>
>>>commenting out the using block in the if block or putting code after
the
>>>using block in the if resolves the problem
>>
>>Richard, i am not quite able to understand the solution for this bug.
It
>>would be really helpful for many of us if you can explain it in more
detail
>>on why such a confusion in the compiler happens in the first place and
why
>>the using block is responsible for creating this behaviour.
>>
>
>Vijay, unfortunately I am not privy to the C# compiler code and so have
no
>idea why it is unable to deal with this situation.
>
>I don't think its the using block per se as I have translated it into
the
>try/finally block that using resolves to and the error still remains.
Here
>is the absolute bare bones to repro the problem
>
><code>
>class App
>{
>    static void Main(string[] args)
>    {
>        if( args.Length == 0 )
>        {
>            Console.WriteLine("in if");
>            try
>            {
>            }
>            finally
>            {
>            }
>        }
>        else
>        {
>            Console.WriteLine("in else");
>        }
>    }
>}
></code>
>
>Regards
>
>Richard Blewett
>DevelopMentor


J. Merrill / Analytical Software Corp

===================================
This list is hosted by DevelopMentor(r)  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

Reply via email to