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 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