Tips on raising event to all event listeners even if listeners raise an exception

By default with default event raising mechanism of C# generated code, CLR aborts raising events to other subscribers when an exception is raised by one of the subscriber. And sometimes it is necessary to raise event to all event listeners even when some of the event subscribers fails by raising an exception.

I myself has faced this situation some of the times and below code can help to address this. Off-course, you should also have a error reporting mechanism built-into your class, otherwise you will end up swallowing all of the exceptions.

Note that below code snippet only focuses on raising events to all of the subscribers, despite failures in some of the event subscribers. And does not account for threading and follow best practices like Exception handling etc. and these are important considerations in real world applications. As a skilled professional C# .NET developer you should consider implementing best practices in your code along with good quality test cases.

Use of invocation list to notify each event subscriber individually

Here is the code snippet (Try running this code on .NET Fiddle):