Back to Devexpress

CRR0010 - Exception without throw

coderushforroslyn-118109-static-code-analysis-analyzers-library-crr0010-exception-without-throw.md

latest654 B
Original Source

CRR0010 - Exception without throw

  • Feb 28, 2025

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

csharp
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.

csharp
throw new InvalidOperationException();

See Also

Suppress Analyzers