foreach nevereding loop issue

Explore, browse and analyze .NET assemblies

Moderators: Bart Read, Luke Jefferson, Clive Tong, nick.maidment

foreach nevereding loop issue

Postby alehandro » Sat Jan 29, 2011 11:04 am

Hi,
I've found rather tricky case with foreach loop in exported sources.

sometimes C# code (break) is generated normal, eg:

for (int i = 1; i < list2.Count; i++)
{
bool flag = false;
foreach (c0002c7 cc2 in list3)
{
if (cc2.m000222() == list2[i].m000222())
{
flag = true;
goto Label_0132;
}
}
Label_0132:
if (!flag)
{
list3.Add(list2[i]);
}
}


but in some tricky(?) cases it produces really strange (buggy?) construction, eg:

string str4 = string.Empty;
Label_0497:
foreach (string str5 in list)
{
bool flag = false;
foreach (string str6 in strArray)
{
if (string.Compare(str5, str6, true) == 0)
{
goto Label_0497;

}
}
if (!flag)
{
str4 = (str4.Length > 0) ? (str4 + \",\" + str5) : str5;
}
}

another one:
string str4 = string.Empty;
Label_045D:
foreach (string str5 in list)
{
bool flag = false;
foreach (string str6 in strArray)
{
if (string.Compare(str5, str6, true) == 0)
{
goto Label_045D;

}
}
if (!flag)
{
str4 = (str4.Length > 0) ? (str4 + \",\" + str5) : str5;
}
}


wow, only now I see that all these cases are 1:1, i.e. the same - but they are from different files!

but there are some others, similar:

Label_047C:
foreach (string str3 in list5)
{
flag3 = false;
foreach (string str4 in strArray)
{
if (string.Compare(str3, str4, true) == 0)
{
goto Label_047C;

}
}
if (!flag3)
{
break;
}
}
if (flag3)
{
list3.Add(cc4);
}

in my understanding instead of that goto after Compare there must be flag = true; break;
alehandro
 
Posts: 35
Joined: Tue Nov 16, 2010 12:08 am

Postby Clive Tong » Sun Jan 30, 2011 8:59 am

Hi.

Do you have an example assembly that shows this problem?

Thanks
Clive Tong
 
Posts: 283
Joined: Thu Dec 04, 2008 5:42 pm

Postby alehandro » Sun Jan 30, 2011 11:40 am

Sure
/rapidshare.com/files/445278008/uo1.zip
alehandro
 
Posts: 35
Joined: Tue Nov 16, 2010 12:08 am

Postby Clive Tong » Mon Jan 31, 2011 10:20 am

Thanks for the example. I've logged it as RP-958.
Clive Tong
 
Posts: 283
Joined: Thu Dec 04, 2008 5:42 pm

Postby alehandro » Mon Jan 31, 2011 5:31 pm

Thank you

Tell me please - I see lots of logged IDs, are these to be included in the nearest build? eg - Reflector 7 b2 or Release?
just curious :)
alehandro
 
Posts: 35
Joined: Tue Nov 16, 2010 12:08 am

Postby Clive Tong » Thu Feb 03, 2011 11:00 am

Hi.

Version 7 is fairly locked down at the moment so we'll only be fixing serious bugs.
Clive Tong
 
Posts: 283
Joined: Thu Dec 04, 2008 5:42 pm

Postby alehandro » Thu Feb 03, 2011 9:11 pm

Thanks
anyway, please keep doing
The tool is just superB
alehandro
 
Posts: 35
Joined: Tue Nov 16, 2010 12:08 am


Return to .NET Reflector 7 EAP

Who is online

Users browsing this forum: No registered users and 0 guests