How to format Exception's stack trace in C#?
问题 When Exception is displayed (or more general - when it is converted to String) stack trace is shown. What I want to do is to change the format of source code's file paths shown in such trace. Specifically I would like to leave filenames only (without full path) or show only that part of path which starts with project's base directory. Full paths are usually unnecessary and clutter the whole message. How can I do that? 回答1: I asked a similar question, although not entirely the same, here: