Skip to content

Fix startup scenario test failures on .NET 11 Preview 2#5119

Open
LoopedBard3 wants to merge 2 commits intodotnet:mainfrom
LoopedBard3:FixPerformanceCIFailures
Open

Fix startup scenario test failures on .NET 11 Preview 2#5119
LoopedBard3 wants to merge 2 commits intodotnet:mainfrom
LoopedBard3:FixPerformanceCIFailures

Conversation

@LoopedBard3
Copy link
Member

  • Update console template pre.py scripts to search for "Console.WriteLine" instead of the removed "// See https://aka.ms/new-console-template" comment
  • Make insert_after() raise an exception when the search string is not found instead of silently succeeding
  • Handle empty parser results in Reporter.WriteResultTable() to prevent InvalidOperationException on .Max() of empty sequence
  • Add diagnostic logging and fail with exit code -1 when parser returns no results in Startup.cs

- Update console template pre.py scripts to search for "Console.WriteLine"
  instead of the removed "// See https://aka.ms/new-console-template" comment
- Make insert_after() raise an exception when the search string is not found
  instead of silently succeeding
- Handle empty parser results in Reporter.WriteResultTable() to prevent
  InvalidOperationException on .Max() of empty sequence
- Add diagnostic logging and fail with exit code -1 when parser returns
  no results in Startup.cs
WPF Template and WPF SFC fail with CloseFailed on generic Helix CI
VMs because CloseMainWindow() doesn't work in headless environments.
This is the same issue that caused WinForms scenarios to be gated.
Gate both WPF scenarios behind SYSTEM_TEAMPROJECT=internal, with
IncludeVMFlakyScenarios override.
@LoopedBard3 LoopedBard3 marked this pull request as ready for review February 13, 2026 18:52
@LoopedBard3 LoopedBard3 self-assigned this Feb 13, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes startup scenario test failures on .NET 11 Preview 2 by adapting to template changes and improving error handling. The .NET 11 Preview 2 console template removed the // See https://aka.ms/new-console-template comment that was previously used to locate where to insert logging calls. The PR updates template scripts to use a more stable search string and adds defensive error handling throughout the stack.

Changes:

  • Updated console template pre.py scripts to search for "Console.WriteLine" instead of the removed template comment
  • Made insert_after() fail fast with an exception when the search string is not found
  • Added empty results handling in Reporter.WriteResultTable() and Startup.cs to prevent crashes and provide diagnostic information
  • Restricted WPF scenarios to internal builds (matching WinForms pattern)

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/scenarios/emptyconsoletemplate/pre.py Updated search string for add_onmain_logging to use "Console.WriteLine"
src/scenarios/emptyconsolenativeaot/pre.py Updated search string for add_onmain_logging to use "Console.WriteLine"
src/scenarios/shared/codefixes.py Added exception when insert_after() search string not found
src/tools/Reporting/Reporting/Reporter.cs Added handling for empty parser results to prevent InvalidOperationException
src/tools/ScenarioMeasurement/Startup/Startup.cs Added diagnostic logging and failure handling for empty parser results
eng/performance/scenarios.proj Restricted WPF scenarios to internal builds or when IncludeVMFlakyScenarios=true

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +75 to +80
if (!test.Counters.Any() || test.Counters.All(c => c.Results == null || c.Results.Count == 0))
{
ret.AppendLine(test.Name);
ret.AppendLine("No results captured. The trace may not contain the expected events.");
continue;
}
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new behavior to handle empty parser results is not covered by tests. Given that ReporterTests.cs contains comprehensive test coverage for other scenarios, a test case should be added to verify that WriteResultTable() correctly handles tests with no results or with all counters having null/empty results. This would ensure the fix prevents the InvalidOperationException and produces the expected "No results captured" message.

Copilot uses AI. Check for mistakes.
@LoopedBard3
Copy link
Member Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant