473,410 Members | 1,908 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,410 software developers and data experts.

unable to handle exception thrown after dispose?

here is some background:

I am using the MQSeries/Websphere .Net classes provided by Microsoft.
The Websphere Windows Client software is required in order to use the
..Net classes. However, I would like to warn users that they need this
software, otherwise they will get a TypeInitializationException ("The
type initializer for 'IBM.WMQ.MQTrace' threw an exception.").

Here is my code to catch that in the form load event:

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

MQEnvironment.Hostname = "x"
MQEnvironment.Port = "x"
MQEnvironment.Channel = "x"
Dim qmgr As MQQueueManager

Try
qmgr = New MQQueueManager("x")
Catch ex As System.TypeInitializationException
MsgBox("an exception occurred. You probably need to
install the MQSeries client software.")
End Try
End Sub

This seems to work ok.

However, the same TypeInitializationException is thrown when I close my
app, and I can't seem to find a way to catch it.

I also tried catching it after calling dispose, but that didn't help
either:

Protected Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
Try
MyBase.Dispose(disposing)
Catch ex As System.TypeInitializationException
MsgBox("an exception occurred.")
End Try
End Sub

The exception occurs sometime after Dispose is called, and I am unable
to catch it.

Here is the stack trace:

at IBM.WMQ.MQTrace.Trace(UInt32 component, UInt32 module, String
traceText)
at IBM.WMQ.MQBaseObject.Trace(UInt32 module, String traceText)
at IBM.WMQ.MQQueueManager.Finalize()

The debugger offers me this after the error is thrown, in case this is
important:

Disassembly:

00000000 push esi
00000001 push eax
00000002 mov dword ptr [esp],ecx
00000005 mov esi,edx
00000007 cmp dword ptr ds:[01101FBCh],0
0000000e je 00000015
00000010 call 7942EABE
00000015 push dword ptr [esp+0Ch]
00000019 mov edx,esi
0000001b mov ecx,2Ch
00000020 call dword ptr ds:[011041C0h]
00000026 nop
00000027 nop
00000028 pop ecx
00000029 pop esi
0000002a ret 4

Thanks.

Oct 4 '06 #1
1 3057
I am using the MQSeries/Websphere .Net classes provided by Microsoft.

err... I mean to say provided by IBM.

Matt

Oct 4 '06 #2

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

Similar topics

6
by: DraguVaso | last post by:
Hi, In my application, on some given actions while debugging in Visual Studio, I suddenly get a "System.ComponentModel.Win32Exception was unhandled" Message="Error creating window handle."...
2
by: Emil Astrom | last post by:
Hi! I wonder if there's a way to retrieve information about thrown, not yet handled exceptions. My situation is similar to the code below: class MySession : IDisposable { : : Dispose()
17
by: ahaupt | last post by:
Hi all, I'm currently writing a load of class libraries, but not the main application iteslf. I want to provide some method for reporting errors back to the main application. At the moment...
2
by: Tyler Foreman | last post by:
Hello, I had an earlier post regarding a strange exception I (thought) I was getting in my windows form. I have since been able to trace the problem to a picturebox control on my form. I can...
3
by: Giovanni Bassi | last post by:
Hello Group, I am running an operation in a different thread. There are resources that are released when the thread is done running. This is done at the end of the execution as it raises an...
7
by: ZorpiedoMan | last post by:
Well, I'm still wondering around in the "land of the lost exception"... It seems that controls that are bound to a class and the class throws an error in the SET method of the bound member, the...
2
by: ashishjainism | last post by:
I am unable to install my windows service and the installutil is throwing the following error: Running a transacted installation. Beginning the Install phase of the installation. See the...
0
by: Buddy Home | last post by:
Hello, I'm trying to upload a file programatically and occasionally I get the following error message. Unable to write data to the transport connection: An established connection was aborted...
7
by: Ralf Jansen | last post by:
For logging purposes i want to determine if the current executing code is running in an ~exceptionhandling context~. I need no details about the exception just if an exception has been thrown and...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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...
0
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,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.