Hello,
I am experiencing a behavior which I think is because there is an exception handling inside of Infragstics code which is wrong and not communicated.
I am not sure whether I am missing something or this is a bug or wrong exception handling.
Reproducing is very simple:
Just define a Data Tree with the check boxes feature and define the NodeCheckedChanged event and throw an exception inside it. You will see that it will not bubble up from the event.
I also attached an example. I am not sure whether what I am doing inside of App is correct but you can compile and run exe file to see that nothing is thrown and the application goes to an undefined state.
Hello Arash,
I have been looking into this issue with our development staff, and this exception appears to not be crashing the program as it is being caught by the BindingExpression class that is built into WPF. The BindingExpression class has a method named UpdateSource, and that appears to be where this exception is being caught, and so the application is not crashing. You can see this by checking the output window in Visual Studio in debug mode and throwing this exception. You should see a System.Windows.Data Error occur if you set your application to not break on the type of exception you are throwing.
Regarding derailing the checkbox functionality, this is expected when throwing an exception at the point that you are throwing it. This exception is essentially short-circuiting the logic that occurs internally that updates the parent or child nodes of the XamDataTree. Since the exception is interrupting the normal code execution path, the internal logic of the XamDataTree never really gets a chance to update the parent or child node's check state.
I am curious as to the functionality that you are really looking to achieve here, to be honest, as intentionally causing your application to crash is not usually a typical requirement. If there is some functionality that you are trying to prevent, why not add a message box or something of the like that informs the user of an invalid operation, rather than throwing an exception and derailing the XamDataTree's execution paths for its checkbox functionality, and then perhaps mark the application or the window that the XamDataTree exists in as closed?
Please let me know if you have any other questions or concerns on this matter.
Sincerely,AndrewAssociate Developer
Hello Andrew,
Thank you for your answer. The showing of the exception in the output window is definitely not because the exception is caught by my code in the App file because there is a throw just after it and the application must crash, if that was the case.
You can easily test by commenting the code in the catch block and see that still the exception is being printed out in the output window which I guess Infragistics code is doing internally.
Yes I am looking for my application to break, when I am throwing an exception and not just in the DEBUG mode in visual studio! You can test it by running the EXE file and see that the application does not crash but the check boxes are not synchronized and the tree goes to an undefined state.
I have taken a look at the sample project that you have sent, and it appears that the Exception that you are throwing is being caught and is being shown in the output window, and this appears to be causing some interesting behavior internal to the XamDataTree, in that the code needed for the checkbox functionality is not able to run due to this exception being thrown.
I'm not sure of the functionality that you are hoping to see in this case, but perhaps you are looking to have your application break when this exception is thrown? If this is the case, I would recommend opening the Exception Settings in Visual Studio and make sure that you have the System.Exception set to true for the "Break When Thrown" field. By doing this, you should see that the application will break upon this exception being thrown.