Stop "common language runtime services" debugging

P

paul

I have a Windows vb.net app that creates an Object from a .net dll that I wrote.
If the dll fails to achieve its task I get it the re-throw an exception.
the windows app encapulates the object creation in a try catch block.
eg
Windows App
------------
Try
__Configuration = New DT.Support.Configuration
Catch ex As Exception
MsgBox(ex.ToString)
Finally

DLL
---
Try
Initialise(GetSetting("General"))
Catch ex As Exception
ExceptionCaught = True
Throw
Finally

THE PROBLEM is even though I'm catching the thrown exception
the "common language runtime services" debugging dialog box pops
up and asks to debug it because it was an unhandled exception,
then my exception handling catches it.
How can I turn off the JITDebugging.
I've tried the App.config " <system.windows.forms jitDebugging="False" /> "
I don't/can't use the machine wide registry setting to turn off JITDebugging.

All I want is for my Windows app to handle any exceptions from my dll.
 
B

Bharat Patel [MSFT]

Paul,

You can implement UnhandledException filter at thread level and APPDomain level
and that should catch all exceptions.
Try the code similar to the following in your windows application.
You will need to start your application using Sub Main.

Shared WithEvents m_appDomain As AppDomain

Shared Sub Main()
m_appDomain = AppDomain.CurrentDomain
AddHandler Application.ThreadException, AddressOf MyHandler
Application.Run(New Form1)
End Sub 'Main

Public Shared Sub MyHandler(ByVal sender As Object, ByVal e As _
ThreadExceptionEventArgs)
MessageBox.Show(e.Exception.ToString, "MyThreadExHandler")
End Sub

Public Shared Sub m_appDomain_UnhandledException(ByVal sender As Object,
ByVal _
e As System.UnhandledExceptionEventArgs) Handles m_appDomain.UnhandledException
Dim ex As Exception = DirectCast(e.ExceptionObject, Exception)
MessageBox.Show(ex.ToString, "MyAppDomainUEHandler")
End Sub



Hope this helps!
Bharat Patel
Microsoft, Visual Basic .NET

This posting is provided "AS IS" with no warranties, and confers no rights.
Please reply to newsgroups only. Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top