Skip to main content

CRR0010 - Exception without throw

This analyzer detects exception objects that were created but not assigned to a variable and were not thrown.

new InvalidOperationException(); // CRR0010

Such objects are redundant because they do not change the program behavior. You can remove the creation of statements or add the throw keyword to throw the created exception instantly.

throw new InvalidOperationException();