Skip to content

Fix CORECLR_NOTIFICATION_PROFILERS dropping entries without trailing ';'#130584

Open
steveisok wants to merge 3 commits into
dotnet:mainfrom
steveisok:steveisok-crispy-barnacle
Open

Fix CORECLR_NOTIFICATION_PROFILERS dropping entries without trailing ';'#130584
steveisok wants to merge 3 commits into
dotnet:mainfrom
steveisok:steveisok-crispy-barnacle

Conversation

@steveisok

Copy link
Copy Markdown
Member

AttemptLoadProfilerList used SString::Find as the loop condition, so any profiler list section not followed by ';' - the last or only entry - was never processed. This silently dropped single-entry lists and the final entry of multi-entry lists, a regression from the .NET 8 wcstok_s-based parser.

Restructure the loop so each section runs up to the next ';' or to the end of the list, and skip empty sections produced by consecutive or trailing separators. This also stops the previous code from reporting a spurious bad-path error for empty sections.

Add a regression test: ProfilerTestRunner gains an optional appendNotificationSeparator flag (default preserves existing behavior), and the multiple profiler test now also runs with no trailing separator for both the CORECLR and DOTNET env var prefixes.

Fixes #126197

AttemptLoadProfilerList used SString::Find as the loop condition, so any
profiler list section not followed by ';' - the last or only entry - was
never processed. This silently dropped single-entry lists and the final
entry of multi-entry lists, a regression from the .NET 8 wcstok_s-based
parser.

Restructure the loop so each section runs up to the next ';' or to the
end of the list, and skip empty sections produced by consecutive or
trailing separators. This also stops the previous code from reporting a
spurious bad-path error for empty sections.

Add a regression test: ProfilerTestRunner gains an optional
appendNotificationSeparator flag (default preserves existing behavior),
and the multiple profiler test now also runs with no trailing separator
for both the CORECLR and DOTNET env var prefixes.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @steveisok, @tommcdon, @dotnet/dotnet-diag
See info in area-owners.md if you want to be subscribed.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 CoreCLR’s CORECLR_NOTIFICATION_PROFILERS list parsing so the final (or only) entry is processed even when the list does not end with a trailing ;, and adds regression coverage to prevent future regressions in both CORECLR_ and DOTNET_-prefixed configurations.

Changes:

  • Fix ProfilingAPIUtility::AttemptLoadProfilerList to iterate sections up to the next ; or end-of-string, and to skip empty sections (consecutive/trailing separators).
  • Extend ProfilerTestRunner.Run with an option to omit the trailing notification-profiler separator when constructing _NOTIFICATION_PROFILERS.
  • Update the multiple-profiler test to run the scenario both with and without a trailing separator for both env-var prefixes.

Reviewed changes

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

File Description
src/coreclr/vm/profilinghelper.cpp Corrects tokenization so the final list entry is not dropped when no trailing ; is present; ignores empty sections.
src/tests/profiler/common/ProfilerTestRunner.cs Adds appendNotificationSeparator to generate notification-profiler lists without a trailing delimiter for regression coverage.
src/tests/profiler/multiple/multiple.cs Runs the multiple-notification-profiler scenario with and without trailing separators for both CORECLR_ and DOTNET_ prefixes.

Comment thread src/tests/profiler/multiple/multiple.cs Outdated
Comment thread src/tests/profiler/multiple/multiple.cs Outdated
Comment on lines +87 to +90
if (result != 100)
{
return result;
}
Comment thread src/coreclr/vm/profilinghelper.cpp Outdated
Comment thread src/coreclr/vm/profilinghelper.cpp Outdated
- Trim the AttemptLoadProfilerList comment to describe only the current
  code rather than the prior loop-condition behavior (per review).
- Remove unreachable 'if (result != 100) return result;' checks in the
  multiple profiler test; ProfilerTestRunner.Run only returns 100 or
  throws, so chain the Run calls and return the last result.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 13, 2026 16:12

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

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

Comment thread src/tests/profiler/multiple/multiple.cs
Comment thread src/tests/profiler/multiple/multiple.cs Outdated
Copilot AI review requested due to automatic review settings July 14, 2026 04:22

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

Comment on lines +71 to +80
// A notification profiler list whose final entry has no trailing ';' must still
// load every entry.
Console.WriteLine($"Running the test with no trailing separator (CORECLR prefix).");
ProfilerTestRunner.Run(profileePath: System.Reflection.Assembly.GetExecutingAssembly().Location,
testName: "MultiplyLoaded",
profilerClsid: MultipleProfilerGuid,
loadAsNotification: true,
notificationCopies: 2,
appendNotificationSeparator: false,
envVarProfilerPrefix: "CORECLR");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CORECLR_NOTIFICATION_PROFILERS silently ignores single-entry lists (.NET 9+ regression)

4 participants