<PackageReference Include="NUnit" Version="4.2.1" />

ExceptionHelper

public static class ExceptionHelper
ExceptionHelper provides static methods for working with exceptions
public static string BuildMessage(Exception exception, bool excludeExceptionNames = false)

Builds up a message, using the Message field of the specified exception as well as any InnerExceptions. Optionally excludes exception names, creating a more readable message.

public static string BuildStackTrace(Exception exception)

Builds up a message, using the Message field of the specified exception as well as any InnerExceptions.

public static void Rethrow(Exception exception)

Rethrows an exception, preserving its stack trace

public static Exception Unwrap(this Exception exception)

Unwraps the exception of type TargetInvocationException to its InnerException.