A "script" cannot do this. You need a static code analyzer that monitors all method calls and detects when an object is created and an object is thrown from Exception. It becomes sticky when the code calls methods in the .NET framework, you do not have the source code for it. System.Reflection does not help, it cannot reflect code.
This is ultimately due to why exception specifications are such a bad idea.
Redgate had a product called "Exception Hunter" to do this. But they refused it, could not make it reliable enough. The interruption announcement is here . Don't buy too many stocks to blame .NET 4 for this.
source share