Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

COM event handler does not raise Exceptions that terminate the application

Posted on 2008-10-02
1
Medium Priority
?
270 Views
Last Modified: 2013-12-17
I have an VB.Net application that has to use a COM object. That COM has an object that raises events that I process.

If inside the eventhandler I make a Throw New Exception() (or an Exception happens) the eventhandler exists (that's the expected behaviour) but nothing more happens. No unhandled exception eventhandlers catch the exception not the application ends with the tipical Unexpected Exception.

The Debuger shows that the COM eventhandler is executing at the main thread if this helps.

As an example you see this code. Executing this produces no result at all, its like it has not been executed
Private Sub DataChange(ByVal eventIdentifier As Integer, ByVal itemsChanged As Integer, ByRef clientHandlesArray As System.Array, ByRef valuesArray As System.Array, ByRef qualities As System.Array, ByRef timeStamps As System.Array) Handles m_mainGroup.DataChange
    Dim index As Integer
 
    Throw New Exception() ' To see what happens
    For index = 1 To itemsChanged
        Me.OnItemChanged(m_itemListByHandler.Item(DirectCast(clientHandlesArray.GetValue(index), Integer)).ItemID, valuesArray.GetValue(index))
    Next
End Sub

Open in new window

0
Comment
Question by:Ignacio Soler Garcia
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 5

Accepted Solution

by:
Ignacio Soler Garcia earned 0 total points
ID: 22768496
The solution to this question is explained here

http://www.codinghorror.com/blog/archives/000216.html

Exceptions rised in threads created outside the CLR are ignored.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
Suggested Courses

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question