I have implemented a UltraGridColumn.GroupComparer routine to sort my group by rows in the ultragrid. The issue I am having is exception trapping. If I trap the exception within the GroupComparer routine, the report displays as if there was no error. If I throw an exception, it is not being caught by my calling routine. How can I abort the report without causing an unhandled exception?
Hi,
What exception are you getting?
You should really avoid calling code that could raise an exception inside an IComparer.
There is no way to catch that without catching exception on your entire application.
I have corrected all known exceptions. The problem is that this code is running in an environment where there may be some meta-data issues that I'm not aware of that could cause the ICompare to fail. Our application is actually a user control that run within a container written by our customer. They normally catch any exceptions we may miss, but it this case that does not happen and it locks up the application. I would like to be able to catch this type of exception so that it doesn't lock up the application.
Hello ,
What you mean with “code is running in an environment where there may be some meta-data issues that I'm not aware of that could cause the ICompare to fail.”
Maybe you could create a class IComparer wrapper , which inherit IComparer interface and has a field of IComparer interface (this will be the actual IComparer, which will be used for comparing your values), in Compare method of your wrapper class you could call Comparer method of IComparer field, in try/ catch bloc, and if there is any exception you could rise some custom event, which will notify you for the exception.
I have implement my idea in a small sample. Please run the sample and drag column “ID” in order to group the grid, see the exceptions report. Please let me know if this is what you are looking for.
I hope this helps you.
Hello,
I am just checking about the progress of this issue. Let me know If you need any further assistance on this issue?
Thank you for using Infragistics Components.
Sincerely,
Hristo
Developer Support Engineer
Infragistics
www.infragistics.com/support