Skip to content

Commit

Permalink
Fix to show right error message on assembly load exception during tes…
Browse files Browse the repository at this point in the history
…t run. (#395)

* Fix to show right error message on assembly load exception during test run

* Add logging
  • Loading branch information
smadala authored Apr 10, 2018
1 parent 05f0865 commit ae4e6d8
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions src/Adapter/MSTest.CoreAdapter/Execution/StackTraceHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,29 @@ internal static StackTraceInformation GetStackTraceInformation(Exception ex)
// Sometimes the stacktrace can be null, but the inner stacktrace
// contains information. We are not interested in null stacktraces
// so we simply ignore this case
if (curException.StackTrace != null)
try
{
if (curException.StackTrace != null)
{
stackTraces.Push(curException.StackTrace);
}
}
catch (Exception e)
{
stackTraces.Push(curException.StackTrace);
// curException.StackTrace can throw exception, Although MSDN doc doesn't say that.
try
{
// try to get stacktrace
if (e.StackTrace != null)
{
stackTraces.Push(e.StackTrace);
}
}
catch (Exception)
{
PlatformServiceProvider.Instance.AdapterTraceLogger.LogError(
"StackTraceHelper.GetStackTraceInformation: Failed to get stacktrace info.");
}
}
}

Expand Down

0 comments on commit ae4e6d8

Please sign in to comment.