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

Reduce alloc in GetStackTraceInformation #4367

Merged
merged 5 commits into from
Dec 17, 2024
Merged
Changes from 3 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
16 changes: 10 additions & 6 deletions src/Adapter/MSTest.TestAdapter/Execution/ExceptionHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,18 +77,22 @@
bool first = true;
while (stackTraces.Count != 0)
{
result.AppendFormat(
CultureInfo.CurrentCulture,
"{0} {1}{2}",
first ? string.Empty : (Resource.UTA_EndOfInnerExceptionTrace + Environment.NewLine),
stackTraces.Pop(),
Environment.NewLine);
if (!first)
{
result.Append(utaEndOfInnerExceptionTrace);
}

result.Append(' ');
result.AppendLine(stackTraces.Pop());

first = false;
}

return CreateStackTraceInformation(ex, true, result.ToString());
}

private static readonly string utaEndOfInnerExceptionTrace = Resource.UTA_EndOfInnerExceptionTrace + Environment.NewLine;

Check failure on line 94 in src/Adapter/MSTest.TestAdapter/Execution/ExceptionHelper.cs

View check run for this annotation

Azure Pipelines / microsoft.testfx (Build MacOS Release)

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

src/Adapter/MSTest.TestAdapter/Execution/ExceptionHelper.cs(94,36): error IDE1006: (NETCORE_ENGINEERING_TELEMETRY=Build) Naming rule violation: These words must begin with upper case characters: utaEndOfInnerExceptionTrace (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide1006)

Check failure on line 94 in src/Adapter/MSTest.TestAdapter/Execution/ExceptionHelper.cs

View check run for this annotation

Azure Pipelines / microsoft.testfx (Build MacOS Release)

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

src/Adapter/MSTest.TestAdapter/Execution/ExceptionHelper.cs(94,36): error SA1311: (NETCORE_ENGINEERING_TELEMETRY=Build) Static readonly fields should begin with upper-case letter (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1311.md)

Check failure on line 94 in src/Adapter/MSTest.TestAdapter/Execution/ExceptionHelper.cs

View check run for this annotation

Azure Pipelines / microsoft.testfx (Build MacOS Release)

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

src/Adapter/MSTest.TestAdapter/Execution/ExceptionHelper.cs(94,36): error IDE1006: (NETCORE_ENGINEERING_TELEMETRY=Build) Naming rule violation: These words must begin with upper case characters: utaEndOfInnerExceptionTrace (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide1006)

Check failure on line 94 in src/Adapter/MSTest.TestAdapter/Execution/ExceptionHelper.cs

View check run for this annotation

Azure Pipelines / microsoft.testfx (Build MacOS Release)

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

src/Adapter/MSTest.TestAdapter/Execution/ExceptionHelper.cs(94,36): error SA1311: (NETCORE_ENGINEERING_TELEMETRY=Build) Static readonly fields should begin with upper-case letter (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1311.md)

Check failure on line 94 in src/Adapter/MSTest.TestAdapter/Execution/ExceptionHelper.cs

View check run for this annotation

Azure Pipelines / microsoft.testfx (Build MacOS Release)

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

src/Adapter/MSTest.TestAdapter/Execution/ExceptionHelper.cs(94,36): error IDE1006: (NETCORE_ENGINEERING_TELEMETRY=Build) Naming rule violation: These words must begin with upper case characters: utaEndOfInnerExceptionTrace (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide1006)

Check failure on line 94 in src/Adapter/MSTest.TestAdapter/Execution/ExceptionHelper.cs

View check run for this annotation

Azure Pipelines / microsoft.testfx (Build MacOS Debug)

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

src/Adapter/MSTest.TestAdapter/Execution/ExceptionHelper.cs(94,36): error IDE1006: (NETCORE_ENGINEERING_TELEMETRY=Build) Naming rule violation: These words must begin with upper case characters: utaEndOfInnerExceptionTrace (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide1006)

Check failure on line 94 in src/Adapter/MSTest.TestAdapter/Execution/ExceptionHelper.cs

View check run for this annotation

Azure Pipelines / microsoft.testfx (Build MacOS Debug)

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

src/Adapter/MSTest.TestAdapter/Execution/ExceptionHelper.cs(94,36): error SA1311: (NETCORE_ENGINEERING_TELEMETRY=Build) Static readonly fields should begin with upper-case letter (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1311.md)

Check failure on line 94 in src/Adapter/MSTest.TestAdapter/Execution/ExceptionHelper.cs

View check run for this annotation

Azure Pipelines / microsoft.testfx (Build MacOS Debug)

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

src/Adapter/MSTest.TestAdapter/Execution/ExceptionHelper.cs(94,36): error IDE1006: (NETCORE_ENGINEERING_TELEMETRY=Build) Naming rule violation: These words must begin with upper case characters: utaEndOfInnerExceptionTrace (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide1006)

Check failure on line 94 in src/Adapter/MSTest.TestAdapter/Execution/ExceptionHelper.cs

View check run for this annotation

Azure Pipelines / microsoft.testfx (Build MacOS Debug)

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

src/Adapter/MSTest.TestAdapter/Execution/ExceptionHelper.cs(94,36): error SA1311: (NETCORE_ENGINEERING_TELEMETRY=Build) Static readonly fields should begin with upper-case letter (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1311.md)

Check failure on line 94 in src/Adapter/MSTest.TestAdapter/Execution/ExceptionHelper.cs

View check run for this annotation

Azure Pipelines / microsoft.testfx (Build Linux Release)

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

src/Adapter/MSTest.TestAdapter/Execution/ExceptionHelper.cs(94,36): error IDE1006: (NETCORE_ENGINEERING_TELEMETRY=Build) Naming rule violation: These words must begin with upper case characters: utaEndOfInnerExceptionTrace (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide1006)

Check failure on line 94 in src/Adapter/MSTest.TestAdapter/Execution/ExceptionHelper.cs

View check run for this annotation

Azure Pipelines / microsoft.testfx (Build Linux Release)

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

src/Adapter/MSTest.TestAdapter/Execution/ExceptionHelper.cs(94,36): error SA1311: (NETCORE_ENGINEERING_TELEMETRY=Build) Static readonly fields should begin with upper-case letter (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1311.md)

Check failure on line 94 in src/Adapter/MSTest.TestAdapter/Execution/ExceptionHelper.cs

View check run for this annotation

Azure Pipelines / microsoft.testfx (Build Linux Release)

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

src/Adapter/MSTest.TestAdapter/Execution/ExceptionHelper.cs(94,36): error IDE1006: (NETCORE_ENGINEERING_TELEMETRY=Build) Naming rule violation: These words must begin with upper case characters: utaEndOfInnerExceptionTrace (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide1006)

Check failure on line 94 in src/Adapter/MSTest.TestAdapter/Execution/ExceptionHelper.cs

View check run for this annotation

Azure Pipelines / microsoft.testfx (Build Linux Release)

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

src/Adapter/MSTest.TestAdapter/Execution/ExceptionHelper.cs(94,36): error SA1311: (NETCORE_ENGINEERING_TELEMETRY=Build) Static readonly fields should begin with upper-case letter (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1311.md)

Check failure on line 94 in src/Adapter/MSTest.TestAdapter/Execution/ExceptionHelper.cs

View check run for this annotation

Azure Pipelines / microsoft.testfx (Build Linux Release)

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

src/Adapter/MSTest.TestAdapter/Execution/ExceptionHelper.cs(94,36): error IDE1006: (NETCORE_ENGINEERING_TELEMETRY=Build) Naming rule violation: These words must begin with upper case characters: utaEndOfInnerExceptionTrace (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide1006)

Check failure on line 94 in src/Adapter/MSTest.TestAdapter/Execution/ExceptionHelper.cs

View check run for this annotation

Azure Pipelines / microsoft.testfx (Build Linux Debug)

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

src/Adapter/MSTest.TestAdapter/Execution/ExceptionHelper.cs(94,36): error IDE1006: (NETCORE_ENGINEERING_TELEMETRY=Build) Naming rule violation: These words must begin with upper case characters: utaEndOfInnerExceptionTrace (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide1006)

Check failure on line 94 in src/Adapter/MSTest.TestAdapter/Execution/ExceptionHelper.cs

View check run for this annotation

Azure Pipelines / microsoft.testfx (Build Linux Debug)

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

src/Adapter/MSTest.TestAdapter/Execution/ExceptionHelper.cs(94,36): error SA1311: (NETCORE_ENGINEERING_TELEMETRY=Build) Static readonly fields should begin with upper-case letter (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1311.md)

Check failure on line 94 in src/Adapter/MSTest.TestAdapter/Execution/ExceptionHelper.cs

View check run for this annotation

Azure Pipelines / microsoft.testfx (Build Linux Debug)

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

src/Adapter/MSTest.TestAdapter/Execution/ExceptionHelper.cs(94,36): error IDE1006: (NETCORE_ENGINEERING_TELEMETRY=Build) Naming rule violation: These words must begin with upper case characters: utaEndOfInnerExceptionTrace (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide1006)

Check failure on line 94 in src/Adapter/MSTest.TestAdapter/Execution/ExceptionHelper.cs

View check run for this annotation

Azure Pipelines / microsoft.testfx (Build Linux Debug)

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

src/Adapter/MSTest.TestAdapter/Execution/ExceptionHelper.cs(94,36): error SA1311: (NETCORE_ENGINEERING_TELEMETRY=Build) Static readonly fields should begin with upper-case letter (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1311.md)

Check failure on line 94 in src/Adapter/MSTest.TestAdapter/Execution/ExceptionHelper.cs

View check run for this annotation

Azure Pipelines / microsoft.testfx

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

src/Adapter/MSTest.TestAdapter/Execution/ExceptionHelper.cs(94,36): error IDE1006: (NETCORE_ENGINEERING_TELEMETRY=Build) Naming rule violation: These words must begin with upper case characters: utaEndOfInnerExceptionTrace (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide1006)

Check failure on line 94 in src/Adapter/MSTest.TestAdapter/Execution/ExceptionHelper.cs

View check run for this annotation

Azure Pipelines / microsoft.testfx

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

src/Adapter/MSTest.TestAdapter/Execution/ExceptionHelper.cs(94,36): error SA1311: (NETCORE_ENGINEERING_TELEMETRY=Build) Static readonly fields should begin with upper-case letter (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1311.md)

Check failure on line 94 in src/Adapter/MSTest.TestAdapter/Execution/ExceptionHelper.cs

View check run for this annotation

Azure Pipelines / microsoft.testfx

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

src/Adapter/MSTest.TestAdapter/Execution/ExceptionHelper.cs(94,36): error IDE1006: (NETCORE_ENGINEERING_TELEMETRY=Build) Naming rule violation: These words must begin with upper case characters: utaEndOfInnerExceptionTrace (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide1006)

Check failure on line 94 in src/Adapter/MSTest.TestAdapter/Execution/ExceptionHelper.cs

View check run for this annotation

Azure Pipelines / microsoft.testfx

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

src/Adapter/MSTest.TestAdapter/Execution/ExceptionHelper.cs(94,36): error SA1311: (NETCORE_ENGINEERING_TELEMETRY=Build) Static readonly fields should begin with upper-case letter (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1311.md)

/// <summary>
/// Removes all stack frames that refer to Microsoft.VisualStudio.TestTools.UnitTesting.Assertion.
/// </summary>
Expand Down
Loading