| Author |
Message |
jackjoy
Joined: 30 Jun 2010 Posts: 4
|
Posted: Fri Jul 02, 2010 3:11 am Post subject: .NET Reflector generate wrong code 2 |
|
|
version 6.5.0.99
(1) generic type:
[C# code]
System.Collections.Generic.List<String><string> list = new System.Collections.Generic.List<String><string>();
(2) property
[IL code]
IL_0006: callvirt instance int32 [mscorlib]System.String::get_Length()
[C# code]
if (this.m_strNodeName.get_Length() == 0)
{
return false;
} |
|
| Back to top |
|
 |
Clive Tong
Joined: 04 Dec 2008 Posts: 182
|
Posted: Fri Jul 02, 2010 10:26 am Post subject: |
|
|
Thanks for reporting these.
The first is already in our bug tracking system.
Do you have a reproducible case for the second. It doesn't happen in some small test examples I have written - I get this.M_strNodeName.Length. |
|
| Back to top |
|
 |
jackjoy
Joined: 30 Jun 2010 Posts: 4
|
Posted: Fri Jul 02, 2010 12:37 pm Post subject: |
|
|
[IL CODE]
.method public hidebysig instance bool Connect(bool silentifnogr) cil managed
{
// Code size 29 (0x1d)
.maxstack 8
IL_0000: ldarg.0
IL_0001: ldfld string ArchestrA.IDE.GalaxyManager::m_strNodeName
IL_0006: callvirt instance int32 [mscorlib]System.String::get_Length()
IL_000b: brtrue.s IL_000f
IL_000d: ldc.i4.0
IL_000e: ret
IL_000f: ldarg.0
IL_0010: ldarg.1
IL_0011: call instance void ArchestrA.IDE.GalaxyManager::ConnectToNode(bool)
IL_0016: ldarg.0
IL_0017: ldfld bool ArchestrA.IDE.GalaxyManager::m_bConnected
IL_001c: ret
} // end of method GalaxyManager::Connect
[C# code]
public bool Connect(bool silentifnogr)
{
if (this.m_strNodeName.get_Length() == 0)
{
return false;
}
this.ConnectToNode(silentifnogr);
return this.m_bConnected;
} |
|
| Back to top |
|
 |
jackjoy
Joined: 30 Jun 2010 Posts: 4
|
Posted: Fri Jul 02, 2010 12:42 pm Post subject: |
|
|
Another example:
[IL code]
.method private hidebysig static string GetArchestraCommonPath() cil managed
{
// Code size 56 (0x38)
.maxstack 3
.locals init (string V_0,
class [mscorlib]Microsoft.Win32.RegistryKey V_1,
class [mscorlib]System.Exception V_2,
string V_3)
.try
{
IL_0000: ldsfld class [mscorlib]Microsoft.Win32.RegistryKey [mscorlib]Microsoft.Win32.Registry::LocalMachine
IL_0005: ldstr "SOFTWARE\\ArchestrA"
IL_000a: ldc.i4.0
IL_000b: callvirt instance class [mscorlib]Microsoft.Win32.RegistryKey [mscorlib]Microsoft.Win32.RegistryKey::OpenSubKey(string,
bool)
IL_0010: stloc.1
IL_0011: ldloc.1
IL_0012: ldstr "CommonPath"
IL_0017: callvirt instance object [mscorlib]Microsoft.Win32.RegistryKey::GetValue(string)
IL_001c: castclass [mscorlib]System.String
IL_0021: stloc.0
IL_0022: leave.s IL_0034
} // end .try
catch [mscorlib]System.Exception
{
IL_0024: stloc.2
IL_0025: ldloc.2
IL_0026: callvirt instance string [mscorlib]System.Exception::get_Message()
IL_002b: call void [System]System.Diagnostics.Trace::Write(string)
IL_0030: ldnull
IL_0031: stloc.3
IL_0032: leave.s IL_0036
} // end handler
IL_0034: ldloc.0
IL_0035: ret
IL_0036: ldloc.3
IL_0037: ret
} // end of method GalaxyManager::GetArchestraCommonPath
[C# code]
private static string GetArchestraCommonPath()
{
string str;
try
{
str = (string) ((string) Registry.LocalMachine.OpenSubKey(@"SOFTWARE\ArchestrA", false).GetValue("CommonPath"));
}
catch (Exception exception)
{
Trace.Write(exception.get_Message());
return null;
}
return str;
} |
|
| Back to top |
|
 |
|
|
All times are GMT
|
| Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group