Use ThrowHelper instead of throw new Exception


When we want to raise an error in the program, we usually use throw new exception and put the appropriate text of the error in the exception class. But if the number of these export errors increases, it will increase the assembly code. ....
Read more

Wrong exception line number in stack trace in release mode


A few days ago, in one of the projects I was working on, an Object reference not set to an instance of an object error was issued, and the line where the error was issued was line 61 in the logs. When I checked line 61 ....
Read more

The difference between throw and throw ex


throw, reissues the error with the same StackTrace as before. issues exactly the same error as before. But if you use throw ex, it still issues the same error as before, but with one difference, it resets StackTrace! For example ....
Read more

Exception handling in Asp.Net Core 3.1


In this section we want to create a general middleware for error management in the program. This means that when an error occurs anywhere in the program, we can find the error with this middleware and show the appropriate message to the user. The way this middleware w ....
Read more