Throw an exception in Debug/Debugger attached, but Log Error in Production?

38 Views Asked by At

There are some paths that I want to throw an Exception when I'm working / debugging, but pass (and Log an error) when in Release.

This means:

  • while working/debugging I can investigate the call stack when this happens
  • this is mainly a cosmetic issue, so in Release people will just see an ugly text instead of the whole application crashing.

Is there already a builtin concept for this? Or any "word" that I can look for?

I know about Asserts, but as far as I know they are completely stripped on Release for performance reasons.

I just want this case to Log on Release.

I am mainly working in C#, but I can imagine this ia general concept.

If there is nothing there I can quite easily built it myself, but I prefer using industry standards.

0

There are 0 best solutions below