This project has moved and is read-only. For the latest updates, please go here.

List of Exceptions to show with some Exception null

Jul 17, 2009 at 2:57 PM


in a project of mine i am in a situation where i pass some exceptions to yhe ExceptionReporter class but i don't know if one of more of this execptions are null.

The current implementation fails if one of the exceptions in the list is null, so i patch one line of the ExceptionReportInfo class to manage this situation.

In the SetExceptions method, i substitute the line: _exceptions.AddRange(exceptions); with this one: _exceptions.AddRange(exceptions.Where(x => (x != null)));

In this way one or more of the exceptions passed to the ExceptionReport can be null, the ExceptionReport show only the not null exceptions.

Don't forget to add the using System.Linq; statement on top.


Hope this can be useful.

Bye, Giuseppe.