Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix to show right error message on assembly load exception during test run. #395

Merged
merged 4 commits into from
Apr 10, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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