Exceptions do not bubble up the call stack!!

C

Carl Tribble

Is there some reason the exceptions in a class with a shared constructor
will
not bubble up the call stack?

I have a class with a shared constructor which calls a shared method
Requery() which initializes the class's shared properties. When an
exception
occurs in the Requery method I want to let it bubble up so I can handle it
elsewhere, but it seems the error will not bubble up. The procedure
(outside of this class) that first accesses a shared property of this class
has an exception handler that should catch the exception raised in the
shared
class's Requery() method, but I still get an "unhandled exception" message
in
the Requery() method.

Thanks,
-CarlT
 
A

alantolan

I managed to recreate the problem and saw the following:

The exception is bubbling up but the IDE is not recognising that is
being handled and is breaking.

- If you change the exception settings in the IDE to 'continue' for
unhandled exceptions then the catch block aound the call will catch the
exception correctly.
- Likewise, build a release version and run it from outside the IDE
and the catch block will work correctly.


A short term option is to leave the 'continue' option on for unhandled
exceptions, which should give you the desired functionality.

Long term, I don't know if this behaviour counts as a bug or a feature.
If a feature, there may be a recommended way to handle type
initialiazation failures.
If a bug, there may be a patch to remedy it.


Alan.
 
C

Carl Tribble

Beautiful! Thanks very much, Alan. I tried changing exception handling to
"continue" for unhandled just like you suggested and it works like a champ.

Thanks again,
-Carl
 

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