Invalid object initializer generated in C# and VB.NET

Explore, browse and analyze .NET assemblies

Moderators: Luke Jefferson, Clive Tong, nick.maidment

Invalid object initializer generated in C# and VB.NET

Postby evgeny » Mon Feb 21, 2011 12:20 am

When decompiling WaIISHost.exe from Windows Azure SDK 1.3 Reflector 7 beta 3 and beta 4 both generate the following code:

Code: Select all
 
           setup = new AppDomainSetup {
                ApplicationName = "RoleManager",
                ApplicationBase = directoryName,
                PrivateBinPath = setup.ApplicationBase
            };


This fails to compile:

error CS0165: Use of unassigned local variable 'setup'


The code should not use an object initializer in this case:

Code: Select all
            setup = new AppDomainSetup();
            setup.ApplicationName = "RoleManager";
            setup.ApplicationBase = directoryName;
            setup.PrivateBinPath = setup.ApplicationBase;
evgeny
 
Posts: 5
Joined: Sun Feb 20, 2011 11:07 pm

Return to .NET Reflector 7 EAP

Who is online

Users browsing this forum: No registered users and 0 guests