I don't normally ask too many questions, but seeing as someone may have come across this before, and I have not, I figured I would throw it out there.

I have a situation where I need to throw an exception in a class library to the calling code (to the consumer of the library). It works everywhere I need it to, except in 1 spot.

I did some testing and I have come to the assumption that it is due to me trying to throw the exception in an event handler that is on a separate thread. I didn’t create this thread, it must just be a product of the .NET classes I am using which are using threads internally and raising events on the threads completion, but in a thread safe manner to my class library (aka I do not need to actually do anything with threading here, it just happens)

So basically it is an internal event handler in my dll class that fires on an internal object (from .net framework) and in this event handler I need to throw an exception in 1 specific case, but need the exception to be send to the calling code. I don’t know if the exceptional condition exists until I hit this event handler, which is why I must throw the exception at this point.