← Back to context

Comment by maximilianburke

11 years ago

Heh.

A few years ago I was on a small team working on a .NET compiler and runtime -- it compiled MSIL into native code targeting x86 and PowerPC. I remember when working on the part of the compiler that built the exception handling routines running into exception filters and wondering what they were for. We were largely targeting C# as a development environment at the time but ended up implementing them in case anyone wanted to use VB.NET. Funny to see that they're now making their way back into C#, even if it's just in the compiler :)

In certain cases, especially with async, using "throw;" can cause a loss of information in a dump. We want compiler bugs to fail fast -- to immediately crash the compiler for debugging and analysis. By using exception filters we can immediately crash the compiler in erroneous conditions, preserving stack, locals, etc.

This isn't just useful for the compiler, but we felt it was necessary for us to make the most reliable, agile product.