Hello,
first of all: this post is about UltraTree in some way, so keep reading ;)
I came across a strange behavior I am really worried about. I can not find any hints what is causing this. Here is the problem:
In our application we handle unhandled exceptions in a specific way, log the stack trace etc with the following subscriptions to the event handlers:
now if I throw a new exception anyway those event handlers are called and everywhere works fine, except for one specific place:
Throwing a new exception in an event handler for BeforeNodeUpdate from UltraTree will not cause the events to fire, so that we can not log anything etc...
why? Please help me! :)
Blue
thank you for all the support.
We discussed about this issue and came to the solution to prevent throwing any exceptions anywhere in the UI project.
Consider this issue as closed. Thanks.
Hi Blue,
BlueScreenISU said:why is the tree handling any exception and not specific ones only?
Because there is no way to know all possible exception types that might be thrown by the data source.
ok I understand that any exception that might occur in the event handler is handled, but there must be a solution to inform the user that something went wrong, right?
I tried to handle the DataError Event, but it is not fired in this case.
Even if I would not raise an user friendly exception directly inside the handler, nothing would happen and the handling is stopped.
I am not throwing exceptions on purpose ;)
I would show some message dialog just to let the user know that something went wrong, but that is not enough for debugging and logging reasons.
You might suggest now to implement the dialog and logging inside the catch block in the event handler, but our usual way was to raise our custom exceptions to be handled in a more general way with deep stack traces, which leads to my next question:
why is the tree handling any exception and not specific ones only?
DataBinding has nothing to do with it. Your sample project is throwing an exception inside an event, but the caller to that event is wrapped in a try...catch block to prevent exceptions on the DataSource from crashing the app. There's no way the tree can conditionally only trap exceptions from the data source and not other exceptions.
Out of curiosity, what exactly are you trying to do here? Why do you have code in this event that is raising an exception? You should probably avoid raising an exception here, anyway, as exceptions cause a pretty big performance hit even when caught.
back from vacation. :)
I have to tell you, that my tree is not databound. The nodes are generated by myself. There is no DataError event firing after an exception occurs.
what now?