473,770 Members | 4,055 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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_TA BLE
Dim f As New TableEditor
f.ShowDialog()

Case MENUITEM_EDIT_T ABLE
Dim f As New TableEditor
f.ShowDialog()
Case MENUITEM_DELETE _TABLE
'SecurityFuncti onsGet()
'Try
' ComponentSecuri tyGet()
'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.Messag e)
End Try
Dim secFunctions As
SecurityFunctio ns.SecurityFunc tionDictionary

' secFunctions =
busApp.GetCompo nentFunctionSec urity("SSCFrame work", _ID, _CN) ***** this line
changes - commented out *****

'MessageBox.Sho w(MyBase.Securi tyFunction(1).I D.ToString)
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
[SecurityFunctio ns]SecurityFunctio ns.SecurityFunc tionDictionary secFunctions,
[4] class [mscorlib]System.Exceptio n 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::.c tor()
IL_0051: stloc.0
IL_0052: ldloc.0
IL_0053: callvirt instance valuetype
[System.Windows. Forms]System.Windows. Forms.DialogRes ult
[System.Windows. Forms]System.Windows. Forms.Form::Sho wDialog()
IL_0058: pop
IL_0059: br.s IL_00ca
IL_005b: nop
IL_005c: newobj instance void SSCMaintenance. TableEditor::.c tor()
IL_0061: stloc.1
IL_0062: ldloc.1
IL_0063: callvirt instance valuetype
[System.Windows. Forms]System.Windows. Forms.DialogRes ult
[System.Windows. Forms]System.Windows. Forms.Form::Sho wDialog()
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.Exceptio n
{
IL_0075: dup
IL_0076: call void
[Microsoft.Visua lBasic]Microsoft.Visua lBasic.Compiler Services.Projec tData::SetProje ctError(class [mscorlib]System.Exceptio n)
IL_007b: stloc.s e
IL_007d: nop
IL_007e: ldloc.s e
IL_0080: callvirt instance string
[mscorlib]System.Exceptio n::get_Message( )
IL_0085: ldc.i4.0
IL_0086: ldnull
IL_0087: call valuetype
[Microsoft.Visua lBasic]Microsoft.Visua lBasic.MsgBoxRe sult

[Microsoft.Visua lBasic]Microsoft.Visua lBasic.Interact ion::MsgBox(obj ect,


valuetype [Microsoft.Visua lBasic]Microsoft.Visua lBasic.MsgBoxSt yle,


object)
IL_008c: pop
IL_008d: call void
[Microsoft.Visua lBasic]Microsoft.Visua lBasic.Compiler Services.Projec tData::ClearPro jectError()
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.DialogRes ult
[System.Windows. Forms]System.Windows. Forms.MessageBo x::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.DialogRes ult
[System.Windows. Forms]System.Windows. Forms.MessageBo x::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.DialogRes ult
[System.Windows. Forms]System.Windows. Forms.MessageBo x::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.DialogRes ult
[System.Windows. Forms]System.Windows. Forms.MessageBo x::Show(string)
IL_00c9: pop
IL_00ca: nop
IL_00cb: nop
IL_00cc: ret
} // end of method Maintenance::Do Cmd

=============== =============== =============== =============== ===============
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.Reflecti on.RuntimeMetho dInfo.InternalI nvoke(Object
obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo

culture, Boolean isBinderDefault , Assembly caller, Boolean verifyAccess)
at System.Reflecti on.RuntimeMetho dInfo.InternalI nvoke(Object obj,
BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo
culture, Boolean

verifyAccess)
at System.Reflecti on.RuntimeMetho dInfo.Invoke(Ob ject obj, BindingFlags
invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Reflecti on.MethodBase.I nvoke(Object obj, Object[] parameters)
at SSCFramework.fr mMain.myMenuCli ck(Object sender, CommandEventArg s e) in
R:\VSSCode\SSCD evelopment\Pres entation\SSCFra mework\frmMain. vb:line 643
at Janus.Windows.U I.CommandBars.C ommandEventHand ler.Invoke(Obje ct sender,
CommandEventArg s e)
at Janus.Windows.U I.CommandBars.U ICommand.OnClic k(CommandEventA rgs e)
at Janus.Windows.U I.CommandBars.U ICommand.ac()
at Janus.Windows.U I.Internal.JNSC S.OnMouseUp(Mou seEventArgs e)
at System.Windows. Forms.Control.W mMouseUp(Messag e& m, MouseButtons
button, Int32 clicks)
at System.Windows. Forms.Control.W ndProc(Message& m)
at Janus.Windows.U I.Internal.JNSC S.WndProc(Messa ge& m)
at System.Windows. Forms.ControlNa tiveWindow.OnMe ssage(Message& m)
at System.Windows. Forms.ControlNa tiveWindow.WndP roc(Message& m)
at System.Windows. Forms.NativeWin dow.Callback(In tPtr hWnd, Int32 msg,
IntPtr wparam, IntPtr lparam)

Public Overrides Sub DoCmd(ByVal ID As Long)
Select Case ID
Case MENUITEM_ADD_TA BLE
Dim f As New TableEditor
f.ShowDialog()

Case MENUITEM_EDIT_T ABLE
Dim f As New TableEditor
f.ShowDialog()
Case MENUITEM_DELETE _TABLE
'SecurityFuncti onsGet()
'Try
' ComponentSecuri tyGet()
'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.Messag e)
End Try
Dim secFunctions As
SecurityFunctio ns.SecurityFunc tionDictionary
-
secFunctions =
busApp.GetCompo nentFunctionSec urity("SSCFrame work", _ID, _CN) ***** this line
changes - included *****

'MessageBox.Sho w(MyBase.Securi tyFunction(1).I D.ToString)
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
[SecurityFunctio ns]SecurityFunctio ns.SecurityFunc tionDictionary secFunctions,
[4] class [mscorlib]System.Exceptio n 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::.c tor()
IL_0054: stloc.0
IL_0055: ldloc.0
IL_0056: callvirt instance valuetype
[System.Windows. Forms]System.Windows. Forms.DialogRes ult
[System.Windows. Forms]System.Windows. Forms.Form::Sho wDialog()
IL_005b: pop
IL_005c: br IL_00e8
IL_0061: nop
IL_0062: newobj instance void SSCMaintenance. TableEditor::.c tor()
IL_0067: stloc.1
IL_0068: ldloc.1
IL_0069: callvirt instance valuetype
[System.Windows. Forms]System.Windows. Forms.DialogRes ult
[System.Windows. Forms]System.Windows. Forms.Form::Sho wDialog()
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.Exceptio n
{
IL_007b: dup
IL_007c: call void
[Microsoft.Visua lBasic]Microsoft.Visua lBasic.Compiler Services.Projec tData::SetProje ctError(class [mscorlib]System.Exceptio n)
IL_0081: stloc.s e
IL_0083: nop
IL_0084: ldloc.s e
IL_0086: callvirt instance string
[mscorlib]System.Exceptio n::get_Message( )
IL_008b: ldc.i4.0
IL_008c: ldnull
IL_008d: call valuetype
[Microsoft.Visua lBasic]Microsoft.Visua lBasic.MsgBoxRe sult

[Microsoft.Visua lBasic]Microsoft.Visua lBasic.Interact ion::MsgBox(obj ect,


valuetype [Microsoft.Visua lBasic]Microsoft.Visua lBasic.MsgBoxSt yle,


object)
IL_0092: pop
IL_0093: call void
[Microsoft.Visua lBasic]Microsoft.Visua lBasic.Compiler Services.Projec tData::ClearPro jectError()
IL_0098: leave.s IL_009a
} // end handler
IL_009a: nop
IL_009b: ldloc.2
IL_009c: ldstr "SSCFramewo rk"
IL_00a1: ldarg.0
IL_00a2: ldfld string SSCMaintenance. Maintenance::_I D
IL_00a7: ldarg.0
IL_00a8: ldfld string SSCMaintenance. Maintenance::_C N
IL_00ad: callvirt instance class
[SecurityFunctio ns]SecurityFunctio ns.SecurityFunc tionDictionary

[BusApplication]BusApplication. BusApplication: :GetComponentFu nctionSecurity( 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.DialogRes ult
[System.Windows. Forms]System.Windows. Forms.MessageBo x::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.DialogRes ult
[System.Windows. Forms]System.Windows. Forms.MessageBo x::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.DialogRes ult
[System.Windows. Forms]System.Windows. Forms.MessageBo x::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.DialogRes ult
[System.Windows. Forms]System.Windows. Forms.MessageBo x::Show(string)
IL_00e7: pop
IL_00e8: nop
IL_00e9: nop
IL_00ea: ret
} // end of method Maintenance::Do Cmd

Nov 22 '05 #1
0 1716

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

Similar topics

42
2393
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
339
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 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?
2
2430
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 exception is getting thrown from within the AsyncCallback on the delegate. For some reason, this causes the AsyncCallback delegate to be executed twice. Now, I understand how to stop the situation from happening. However, what I didn't know was...
16
6592
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 compiler would give you error. In C#, is there a way to do that?
44
4228
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 user tasks should always be included in a try/catch block that actually handles any exceptions that occur (log the exception, display a message box, etc.). 2. Low-level operations that are used to carry out the high level tasks
13
2322
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 Application.Run(new Form1()); i have setup a global keyboard hook
7
3102
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 whatever reason. What is the recommended way of doing this? Thrown an exception of a property is assigned a bad value? Throw an exception when a method is called that needs to use that value? Create
6
1282
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) MessageBox.show("n is 0"); or second way
43
2115
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 an exception in case of failure? If the second approach is to be suggested: Should .NET predefined exceptions, NullReferenceException, IndexOutOfRangeException and so on, or my own exceptions be thrown?
7
5144
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 methods internally. My thought was, the exception is being rethrown and propagated by the non-public methods to the public methods, causing performance overhead (stack winding etc). I do agree that, the purpose of throwing the exception by...
0
9425
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10230
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10058
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10004
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9870
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8886
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7416
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
3972
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2817
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.