Search code examples
c#exceptioninner-exception

What is the proper way to display the full InnerException?


What is the proper way to show my full InnerException.

I found that some of my InnerExceptions has another InnerException and that go's on pretty deep.

Will InnerException.ToString() do the job for me or do I need to loop through the InnerExceptions and build up a String with StringBuilder?


Solution

  • You can simply print exception.ToString() -- that will also include the full text for all the nested InnerExceptions.