i have a method which throws an exception. the thing i dont understand is
that the only change between the two versions is a line of code AFTER the one
that
throws the exception - see code below
the only difference between the il BEFORE the line throwing the exception is
a BR.S as opposed to BR, due to the length of the branch required, which
makes sense.
anyone know what is going on?
this code works as expected
Public Overrides Sub DoCmd(ByVal ID As Long)
Select Case ID
Case MENUITEM_ADD_TABLE
Dim f As New TableEditor
f.ShowDialog()
Case MENUITEM_EDIT_TABLE
Dim f As New TableEditor
f.ShowDialog()
Case MENUITEM_DELETE_TABLE
'SecurityFunctionsGet()
'Try
' ComponentSecurityGet()
'Catch e As Exception
' MessageBox.Show(e.Message)
'End Try
Dim busApp As BusApplication.BusApplication
Try
busApp = New BusApplication.BusApplication
Catch e As Exception
MsgBox(e.Message)
End Try
Dim secFunctions As
SecurityFunctions.SecurityFunctionDictionary
' secFunctions =
busApp.GetComponentFunctionSecurity("SSCFramework" , _ID, _CN) ***** this line
changes - commented out *****
'MessageBox.Show(MyBase.SecurityFunction(1).ID.ToS tring)
MessageBox.Show("Are you sure you want to delete the
selected table")
Case MENUITEM_INSERT
MessageBox.Show("Insert")
Case MENUITEM_UPDATE
MessageBox.Show("Update")
Case MENUITEM_REMOVE
MessageBox.Show("Are you sure you want to delete the
selected row")
End Select
End Sub
..method public strict virtual instance void
DoCmd(int64 ID) cil managed
{
// Code size 205 (0xcd)
.maxstack 3
.locals init ([0] class SSCMaintenance.TableEditor f,
[1] class SSCMaintenance.TableEditor V_1,
[2] class [BusApplication]BusApplication.BusApplication busApp,
[3] class
[SecurityFunctions]SecurityFunctions.SecurityFunctionDictionary secFunctions,
[4] class [mscorlib]System.Exception e,
[5] int64 _Vb_t_i8_0)
IL_0000: nop
IL_0001: nop
IL_0002: ldarg.1
IL_0003: stloc.s _Vb_t_i8_0
IL_0005: ldloc.s _Vb_t_i8_0
IL_0007: ldc.i8 0x6
IL_0010: bgt IL_00ca
IL_0015: ldloc.s _Vb_t_i8_0
IL_0017: ldc.i8 0x0
IL_0020: blt IL_00ca
IL_0025: ldloc.s _Vb_t_i8_0
IL_0027: conv.i4
IL_0028: switch (
IL_004b,
IL_005b,
IL_006b,
IL_00ca,
IL_00a2,
IL_00b0,
IL_00be)
IL_0049: br.s IL_00ca
IL_004b: nop
IL_004c: newobj instance void SSCMaintenance.TableEditor::.ctor()
IL_0051: stloc.0
IL_0052: ldloc.0
IL_0053: callvirt instance valuetype
[System.Windows.Forms]System.Windows.Forms.DialogResult
[System.Windows.Forms]System.Windows.Forms.Form::ShowDialog()
IL_0058: pop
IL_0059: br.s IL_00ca
IL_005b: nop
IL_005c: newobj instance void SSCMaintenance.TableEditor::.ctor()
IL_0061: stloc.1
IL_0062: ldloc.1
IL_0063: callvirt instance valuetype
[System.Windows.Forms]System.Windows.Forms.DialogResult
[System.Windows.Forms]System.Windows.Forms.Form::ShowDialog()
IL_0068: pop
IL_0069: br.s IL_00ca
IL_006b: nop
IL_006c: nop
.try
{
IL_006d: newobj instance void
[BusApplication]BusApplication.BusApplication::.ctor()
IL_0072: stloc.2
IL_0073: leave.s IL_0094
} // end .try
catch [mscorlib]System.Exception
{
IL_0075: dup
IL_0076: call void
[Microsoft.VisualBasic]Microsoft.VisualBasic.CompilerServices.ProjectData ::SetProjectError(class [mscorlib]System.Exception)
IL_007b: stloc.s e
IL_007d: nop
IL_007e: ldloc.s e
IL_0080: callvirt instance string
[mscorlib]System.Exception::get_Message()
IL_0085: ldc.i4.0
IL_0086: ldnull
IL_0087: call valuetype
[Microsoft.VisualBasic]Microsoft.VisualBasic.MsgBoxResult
[Microsoft.VisualBasic]Microsoft.VisualBasic.Interaction::MsgBox(object,
valuetype [Microsoft.VisualBasic]Microsoft.VisualBasic.MsgBoxStyle,
object)
IL_008c: pop
IL_008d: call void
[Microsoft.VisualBasic]Microsoft.VisualBasic.CompilerServices.ProjectData ::ClearProjectError()
IL_0092: leave.s IL_0094
} // end handler
IL_0094: nop
IL_0095: ldstr "Are you sure you want to delete the selected table"
IL_009a: call valuetype
[System.Windows.Forms]System.Windows.Forms.DialogResult
[System.Windows.Forms]System.Windows.Forms.MessageBox::Show(string)
IL_009f: pop
IL_00a0: br.s IL_00ca
IL_00a2: nop
IL_00a3: ldstr "Insert"
IL_00a8: call valuetype
[System.Windows.Forms]System.Windows.Forms.DialogResult
[System.Windows.Forms]System.Windows.Forms.MessageBox::Show(string)
IL_00ad: pop
IL_00ae: br.s IL_00ca
IL_00b0: nop
IL_00b1: ldstr "Update"
IL_00b6: call valuetype
[System.Windows.Forms]System.Windows.Forms.DialogResult
[System.Windows.Forms]System.Windows.Forms.MessageBox::Show(string)
IL_00bb: pop
IL_00bc: br.s IL_00ca
IL_00be: nop
IL_00bf: ldstr "Are you sure you want to delete the selected row"
IL_00c4: call valuetype
[System.Windows.Forms]System.Windows.Forms.DialogResult
[System.Windows.Forms]System.Windows.Forms.MessageBox::Show(string)
IL_00c9: pop
IL_00ca: nop
IL_00cb: nop
IL_00cc: ret
} // end of method Maintenance::DoCmd
================================================== =========================
this code throws an exception when instantiating the busapplication object
Assembly: SSCFramework
Module: frmMain
Procedure: myMenuClick
Description: Exception has been thrown by the target of an invocation.
Stack Trace: at System.Reflection.RuntimeMethodInfo.InternalInvoke (Object
obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo
culture, Boolean isBinderDefault, Assembly caller, Boolean verifyAccess)
at System.Reflection.RuntimeMethodInfo.InternalInvoke (Object obj,
BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo
culture, Boolean
verifyAccess)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags
invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
at SSCFramework.frmMain.myMenuClick(Object sender, CommandEventArgs e) in
R:\VSSCode\SSCDevelopment\Presentation\SSCFramewor k\frmMain.vb:line 643
at Janus.Windows.UI.CommandBars.CommandEventHandler.I nvoke(Object sender,
CommandEventArgs e)
at Janus.Windows.UI.CommandBars.UICommand.OnClick(Com mandEventArgs e)
at Janus.Windows.UI.CommandBars.UICommand.ac()
at Janus.Windows.UI.Internal.JNSCS.OnMouseUp(MouseEve ntArgs e)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons
button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at Janus.Windows.UI.Internal.JNSCS.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage (Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(M essage& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg,
IntPtr wparam, IntPtr lparam)
Public Overrides Sub DoCmd(ByVal ID As Long)
Select Case ID
Case MENUITEM_ADD_TABLE
Dim f As New TableEditor
f.ShowDialog()
Case MENUITEM_EDIT_TABLE
Dim f As New TableEditor
f.ShowDialog()
Case MENUITEM_DELETE_TABLE
'SecurityFunctionsGet()
'Try
' ComponentSecurityGet()
'Catch e As Exception
' MessageBox.Show(e.Message)
'End Try
Dim busApp As BusApplication.BusApplication
Try
busApp = New BusApplication.BusApplication *****
this line throws an exception *****
Catch e As Exception
MsgBox(e.Message)
End Try
Dim secFunctions As
SecurityFunctions.SecurityFunctionDictionary
-
secFunctions =
busApp.GetComponentFunctionSecurity("SSCFramework" , _ID, _CN) ***** this line
changes - included *****
'MessageBox.Show(MyBase.SecurityFunction(1).ID.ToS tring)
MessageBox.Show("Are you sure you want to delete the
selected table")
Case MENUITEM_INSERT
MessageBox.Show("Insert")
Case MENUITEM_UPDATE
MessageBox.Show("Update")
Case MENUITEM_REMOVE
MessageBox.Show("Are you sure you want to delete the
selected row")
End Select
End Sub
..method public strict virtual instance void
DoCmd(int64 ID) cil managed
{
// Code size 235 (0xeb)
.maxstack 4
.locals init ([0] class SSCMaintenance.TableEditor f,
[1] class SSCMaintenance.TableEditor V_1,
[2] class [BusApplication]BusApplication.BusApplication busApp,
[3] class
[SecurityFunctions]SecurityFunctions.SecurityFunctionDictionary secFunctions,
[4] class [mscorlib]System.Exception e,
[5] int64 _Vb_t_i8_0)
IL_0000: nop
IL_0001: nop
IL_0002: ldarg.1
IL_0003: stloc.s _Vb_t_i8_0
IL_0005: ldloc.s _Vb_t_i8_0
IL_0007: ldc.i8 0x6
IL_0010: bgt IL_00e8
IL_0015: ldloc.s _Vb_t_i8_0
IL_0017: ldc.i8 0x0
IL_0020: blt IL_00e8
IL_0025: ldloc.s _Vb_t_i8_0
IL_0027: conv.i4
IL_0028: switch (
IL_004e,
IL_0061,
IL_0071,
IL_00e8,
IL_00c0,
IL_00ce,
IL_00dc)
IL_0049: br IL_00e8
IL_004e: nop
IL_004f: newobj instance void SSCMaintenance.TableEditor::.ctor()
IL_0054: stloc.0
IL_0055: ldloc.0
IL_0056: callvirt instance valuetype
[System.Windows.Forms]System.Windows.Forms.DialogResult
[System.Windows.Forms]System.Windows.Forms.Form::ShowDialog()
IL_005b: pop
IL_005c: br IL_00e8
IL_0061: nop
IL_0062: newobj instance void SSCMaintenance.TableEditor::.ctor()
IL_0067: stloc.1
IL_0068: ldloc.1
IL_0069: callvirt instance valuetype
[System.Windows.Forms]System.Windows.Forms.DialogResult
[System.Windows.Forms]System.Windows.Forms.Form::ShowDialog()
IL_006e: pop
IL_006f: br.s IL_00e8
IL_0071: nop
IL_0072: nop
.try
{
IL_0073: newobj instance void
[BusApplication]BusApplication.BusApplication::.ctor()
IL_0078: stloc.2
IL_0079: leave.s IL_009a
} // end .try
catch [mscorlib]System.Exception
{
IL_007b: dup
IL_007c: call void
[Microsoft.VisualBasic]Microsoft.VisualBasic.CompilerServices.ProjectData ::SetProjectError(class [mscorlib]System.Exception)
IL_0081: stloc.s e
IL_0083: nop
IL_0084: ldloc.s e
IL_0086: callvirt instance string
[mscorlib]System.Exception::get_Message()
IL_008b: ldc.i4.0
IL_008c: ldnull
IL_008d: call valuetype
[Microsoft.VisualBasic]Microsoft.VisualBasic.MsgBoxResult
[Microsoft.VisualBasic]Microsoft.VisualBasic.Interaction::MsgBox(object,
valuetype [Microsoft.VisualBasic]Microsoft.VisualBasic.MsgBoxStyle,
object)
IL_0092: pop
IL_0093: call void
[Microsoft.VisualBasic]Microsoft.VisualBasic.CompilerServices.ProjectData ::ClearProjectError()
IL_0098: leave.s IL_009a
} // end handler
IL_009a: nop
IL_009b: ldloc.2
IL_009c: ldstr "SSCFramework"
IL_00a1: ldarg.0
IL_00a2: ldfld string SSCMaintenance.Maintenance::_ID
IL_00a7: ldarg.0
IL_00a8: ldfld string SSCMaintenance.Maintenance::_CN
IL_00ad: callvirt instance class
[SecurityFunctions]SecurityFunctions.SecurityFunctionDictionary
[BusApplication]BusApplication.BusApplication::GetComponentFunctio nSecurity(string,
string,
string)
IL_00b2: stloc.3
IL_00b3: ldstr "Are you sure you want to delete the selected table"
IL_00b8: call valuetype
[System.Windows.Forms]System.Windows.Forms.DialogResult
[System.Windows.Forms]System.Windows.Forms.MessageBox::Show(string)
IL_00bd: pop
IL_00be: br.s IL_00e8
IL_00c0: nop
IL_00c1: ldstr "Insert"
IL_00c6: call valuetype
[System.Windows.Forms]System.Windows.Forms.DialogResult
[System.Windows.Forms]System.Windows.Forms.MessageBox::Show(string)
IL_00cb: pop
IL_00cc: br.s IL_00e8
IL_00ce: nop
IL_00cf: ldstr "Update"
IL_00d4: call valuetype
[System.Windows.Forms]System.Windows.Forms.DialogResult
[System.Windows.Forms]System.Windows.Forms.MessageBox::Show(string)
IL_00d9: pop
IL_00da: br.s IL_00e8
IL_00dc: nop
IL_00dd: ldstr "Are you sure you want to delete the selected row"
IL_00e2: call valuetype
[System.Windows.Forms]System.Windows.Forms.DialogResult
[System.Windows.Forms]System.Windows.Forms.MessageBox::Show(string)
IL_00e7: pop
IL_00e8: nop
IL_00e9: nop
IL_00ea: ret
} // end of method Maintenance::DoCmd