J
Joe Simmonds
Hi All,
I have just had a problem with some VB.net, I wonder if anybody can shed a little light and ease my confused brain. The problem is resolved now but I can't work out what happened and, more importantly, I can't guarantee it won't happen again. Have I misunderstood the situation? Can anybody help?
An error was spotted in a running application (A new build had just been deployed). When we stepped through the source the debugger would step completely over a line of code without executing it. When I ran ILDASM on the dll with show source lines the source line that was being missed out would be shown but no compiled code seemed to have been inserted into the dll. Below is a transcript of the ildasm output. The line 164 (in the VB source) where a call to Me.SelectAddParms seems to generate no il code at all. The il code for all the following vb source lines seems also to have been moved up to the line above.
//000162: Me.ClearSelectParms()
IL_0001: ldarg.0
IL_0002: callvirt instance void [AIM2DataClasses]PI_BaseClasses.clsPIDBBaseExtension::ClearSelectParms()
IL_0007: nop
//000163:
//000164: Me.SelectAddParms(FieldList.clsContactFieldList.NTLogon, sNTLogon)
IL_0008: ldarg.0
IL_0009: callvirt instance class [System.Data]System.Data.DataTable [AIM2DataClasses]PI_BaseClasses.clsPIDBBaseExtension::Select()
IL_000e: callvirt instance class [System.Data]System.Data.DataRowCollection [System.Data]System.Data.DataTable::get_Rows()
IL_0013: callvirt instance int32 [System.Data]System.Data.InternalDataCollectionBase::get_Count()
IL_0018: ldc.i4.0
IL_0019: ble.s IL_0040
//000165: If Me.Select.Rows.Count > 0 Then
IL_001b: ldarg.0
IL_001c: callvirt instance class [System.Data]System.Data.DataTable [AIM2DataClasses]PI_BaseClasses.clsPIDBBaseExtension::Select()
IL_0021: callvirt instance class [System.Data]System.Data.DataRowCollection [System.Data]System.Data.DataTable::get_Rows()
IL_0026: ldc.i4.0
IL_0027: callvirt instance class [System.Data]System.Data.DataRow [System.Data]System.Data.DataRowCollection::get_Item(int32)
IL_002c: ldstr "ContactID"
IL_0031: callvirt instance object [System.Data]System.Data.DataRow::get_Item(string)
IL_0036: call int32 [Microsoft.VisualBasic]Microsoft.VisualBasic.CompilerServices.IntegerType::FromObject(object)
IL_003b: stloc.0
IL_003c: br.s IL_0046
IL_003e: br.s IL_0045
Rebuilding this dll individually seemed to have no effect but the problem was resolved by building all of the dlls in the project, some of which this code uses. A transcript of the ILDASM output for the same section after the resolution is below. Four additional lines of il were produced. These lines are the call to the required method. No changes to the source code were made.
//000162: Me.ClearSelectParms()
IL_0001: ldarg.0
IL_0002: callvirt instance void [AIM2DataClasses]PI_BaseClasses.clsPIDBBaseExtension::ClearSelectParms()
IL_0007: nop
//000163:
//000164: Me.SelectAddParms(FieldList.clsContactFieldList.NTLogon, sNTLogon)
IL_0008: ldarg.0
IL_0009: ldc.i4.s 16
IL_000b: ldarg.1
IL_000c: callvirt instance void [AIM2DataClasses]PI_BaseClasses.clsPIDBBaseExtension::SelectAddParms(int32,
object)
IL_0011: nop
//000165: If Me.Select.Rows.Count > 0 Then
IL_0012: ldarg.0
IL_0013: callvirt instance class [System.Data]System.Data.DataTable [AIM2DataClasses]PI_BaseClasses.clsPIDBBaseExtension::Select()
IL_0018: callvirt instance class [System.Data]System.Data.DataRowCollection [System.Data]System.Data.DataTable::get_Rows()
IL_001d: callvirt instance int32 [System.Data]System.Data.InternalDataCollectionBase::get_Count()
IL_0022: ldc.i4.0
IL_0023: ble.s IL_004a
Many Thanks
Joe Simmonds
I have just had a problem with some VB.net, I wonder if anybody can shed a little light and ease my confused brain. The problem is resolved now but I can't work out what happened and, more importantly, I can't guarantee it won't happen again. Have I misunderstood the situation? Can anybody help?
An error was spotted in a running application (A new build had just been deployed). When we stepped through the source the debugger would step completely over a line of code without executing it. When I ran ILDASM on the dll with show source lines the source line that was being missed out would be shown but no compiled code seemed to have been inserted into the dll. Below is a transcript of the ildasm output. The line 164 (in the VB source) where a call to Me.SelectAddParms seems to generate no il code at all. The il code for all the following vb source lines seems also to have been moved up to the line above.
//000162: Me.ClearSelectParms()
IL_0001: ldarg.0
IL_0002: callvirt instance void [AIM2DataClasses]PI_BaseClasses.clsPIDBBaseExtension::ClearSelectParms()
IL_0007: nop
//000163:
//000164: Me.SelectAddParms(FieldList.clsContactFieldList.NTLogon, sNTLogon)
IL_0008: ldarg.0
IL_0009: callvirt instance class [System.Data]System.Data.DataTable [AIM2DataClasses]PI_BaseClasses.clsPIDBBaseExtension::Select()
IL_000e: callvirt instance class [System.Data]System.Data.DataRowCollection [System.Data]System.Data.DataTable::get_Rows()
IL_0013: callvirt instance int32 [System.Data]System.Data.InternalDataCollectionBase::get_Count()
IL_0018: ldc.i4.0
IL_0019: ble.s IL_0040
//000165: If Me.Select.Rows.Count > 0 Then
IL_001b: ldarg.0
IL_001c: callvirt instance class [System.Data]System.Data.DataTable [AIM2DataClasses]PI_BaseClasses.clsPIDBBaseExtension::Select()
IL_0021: callvirt instance class [System.Data]System.Data.DataRowCollection [System.Data]System.Data.DataTable::get_Rows()
IL_0026: ldc.i4.0
IL_0027: callvirt instance class [System.Data]System.Data.DataRow [System.Data]System.Data.DataRowCollection::get_Item(int32)
IL_002c: ldstr "ContactID"
IL_0031: callvirt instance object [System.Data]System.Data.DataRow::get_Item(string)
IL_0036: call int32 [Microsoft.VisualBasic]Microsoft.VisualBasic.CompilerServices.IntegerType::FromObject(object)
IL_003b: stloc.0
IL_003c: br.s IL_0046
IL_003e: br.s IL_0045
Rebuilding this dll individually seemed to have no effect but the problem was resolved by building all of the dlls in the project, some of which this code uses. A transcript of the ILDASM output for the same section after the resolution is below. Four additional lines of il were produced. These lines are the call to the required method. No changes to the source code were made.
//000162: Me.ClearSelectParms()
IL_0001: ldarg.0
IL_0002: callvirt instance void [AIM2DataClasses]PI_BaseClasses.clsPIDBBaseExtension::ClearSelectParms()
IL_0007: nop
//000163:
//000164: Me.SelectAddParms(FieldList.clsContactFieldList.NTLogon, sNTLogon)
IL_0008: ldarg.0
IL_0009: ldc.i4.s 16
IL_000b: ldarg.1
IL_000c: callvirt instance void [AIM2DataClasses]PI_BaseClasses.clsPIDBBaseExtension::SelectAddParms(int32,
object)
IL_0011: nop
//000165: If Me.Select.Rows.Count > 0 Then
IL_0012: ldarg.0
IL_0013: callvirt instance class [System.Data]System.Data.DataTable [AIM2DataClasses]PI_BaseClasses.clsPIDBBaseExtension::Select()
IL_0018: callvirt instance class [System.Data]System.Data.DataRowCollection [System.Data]System.Data.DataTable::get_Rows()
IL_001d: callvirt instance int32 [System.Data]System.Data.InternalDataCollectionBase::get_Count()
IL_0022: ldc.i4.0
IL_0023: ble.s IL_004a
Many Thanks
Joe Simmonds