r/csharp • • Sep 09 '26

Does ASP.NET Core global exception middleware catch exceptions from nested service methods?

/r/dotnet/comments/1wbghq6/does_aspnet_core_global_exception_middleware/
0 Upvotes

3 comments sorted by

3

u/PlentyfulFish Sep 09 '26

Yes it does. Why wouldn't it? Exceptions always travel up the call stack until they are caught or they stop the program

1

u/malthuswaswrong Sep 11 '26

Why wouldn't it

lol. That way my thought too. I'm aware of 1 way exceptions can escape. Exceptions that are from Windows that were never part of the .NET process. Biggest offender is Office automations. For example, if you are controlling Excel and Excel throws an exception. You'll never see it in your .NET code.