Skip to content

Commit 97ee44f

Browse files
authored
Delete dead code in ExceptionHelper (#5704)
1 parent 45dec3b commit 97ee44f

File tree

2 files changed

+3
-17
lines changed

2 files changed

+3
-17
lines changed

src/Adapter/MSTest.TestAdapter/Execution/ExceptionHelper.cs

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ internal static class ExceptionHelper
8383
first = false;
8484
}
8585

86-
return CreateStackTraceInformation(ex, true, result.ToString());
86+
return CreateStackTraceInformation(result.ToString());
8787
}
8888

8989
/// <summary>
@@ -173,28 +173,14 @@ internal static string GetFormattedExceptionMessage(this Exception ex)
173173
/// <summary>
174174
/// Create stack trace information.
175175
/// </summary>
176-
/// <param name="ex">
177-
/// The exception.
178-
/// </param>
179-
/// <param name="checkInnerExceptions">
180-
/// Whether the inner exception needs to be checked too.
181-
/// </param>
182176
/// <param name="stackTraceString">
183177
/// The stack Trace String.
184178
/// </param>
185179
/// <returns>
186180
/// The <see cref="StackTraceInformation"/>.
187181
/// </returns>
188-
internal static StackTraceInformation? CreateStackTraceInformation(
189-
Exception ex,
190-
bool checkInnerExceptions,
191-
string stackTraceString)
182+
internal static StackTraceInformation? CreateStackTraceInformation(string stackTraceString)
192183
{
193-
if (checkInnerExceptions && ex.InnerException != null)
194-
{
195-
return CreateStackTraceInformation(ex.InnerException, checkInnerExceptions, stackTraceString);
196-
}
197-
198184
string stackTrace = TrimStackTrace(stackTraceString);
199185

200186
return !StringEx.IsNullOrEmpty(stackTrace) ? new StackTraceInformation(stackTrace, null, 0, 0) : null;

src/Adapter/MSTest.TestAdapter/Extensions/ExceptionExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ internal static string TryGetMessage(this Exception? exception)
5454
/// <param name="exception">An <see cref="Exception"/> instance.</param>
5555
/// <returns>StackTraceInformation for the exception.</returns>
5656
internal static StackTraceInformation? TryGetStackTraceInformation(this Exception exception) => !StringEx.IsNullOrEmpty(exception.StackTrace)
57-
? ExceptionHelper.CreateStackTraceInformation(exception, false, exception.StackTrace)
57+
? ExceptionHelper.CreateStackTraceInformation(exception.StackTrace)
5858
: null;
5959

6060
/// <summary>

0 commit comments

Comments
 (0)