473,385 Members | 1,942 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

odd exception situation

guy


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

Nov 22 '05 #1
0 1680

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

42
by: cody | last post by:
public DateTime Value { get { try { return new DateTime(int.Parse(tbYear.Text), int.Parse(tbMonth.Text), int.Parse(tbDay.Text)); } catch (FormatException)
0
by: guy | last post by:
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...
2
by: Craig Vermeer | last post by:
Hi All, I noticed an interesting issue the other day, and thought someone here might be able to shed some light on things. I have a situation where I'm using asynchronous delegates, and an...
16
by: ChInKPoInt [No MCSD] | last post by:
I am using Visual Studio 2K3 writing a ASP.NET web application. Is there a way to force the C# compiler to catch possible exception? In Java, all exceptions thrown MUST BE caught, otherwise...
44
by: craig | last post by:
I am wondering if there are some best practices for determining a strategy for using try/catch blocks within an application. My current thoughts are: 1. The code the initiates any high-level...
13
by: tolisss | last post by:
Hi i have setup a global exception handler b4 Application.Run like Application.ThreadException += new ThreadExceptionEventHandler(GlobalExceptionProcessing.AppThreadException ); then after...
7
by: Andy | last post by:
Hi all, This is more of a design question. I'm building an n-tier application, and the question revolves around the buisness layer telling the application that a value is not appropriate for...
6
by: perspolis | last post by:
Hi I have a question about using exceptions or showing error messages .I say this by an example first way: if(n<0 and w<0) MessageBox.Show("please enter positive") else if (n=0 or w>0)...
43
by: Shehab Kamal | last post by:
Which approach is better: 1) Use a method that returns true/false (the method will log the exception that lead to false using log4net for example) OR 2) Use a method that returns void and throws...
7
by: Sek | last post by:
Hi Folks! I was pondering over a code and noticed that exception handlers were present in the private, protected as well as public methods. And, ofcourse, public methods were calling priv/prot...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.