I am adding a global exception handling project to my solution and have installed the Microsoft.AspNetCore.Diagnostics NuGet package. Although the package is recognized and listed in the project’s dependencies, I encounter an error when trying to use the IExceptionHandler interface. The error message is:
CS0234: The type or namespace name 'IExceptionHandler' does not exist in the namespace 'Microsoft.AspNetCore.Diagnostics' (are you missing an assembly reference?)
I am sharing this because similar issues on StackOverflow don’t address problems specific to the Microsoft.AspNetCore.Diagnostics
package. Other references, like Microsoft.AspNetCore.Mvc
and System.Data.SqlClient
, resolve fine for my project. An older but similar issue was posted here. However, it does not exactly match my scenario.
Here are a few observations:
-
Uninstalling the Microsoft.AspNetCore.Diagnostics package doesn’t cause VS to flag the using statement.
-
A working project doesn’t have this package in its dependencies, which is puzzling.
-
I have reset VS settings, cleared caches, and reinstalled VS, but the issue persists.
-
The project builds despite the errors, which is also confusing.
aim is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.