Skip to content

CallSiteLayoutRenderer - Obsolete CleanNamesOfAnonymousDelegates + CleanNamesOfAsyncContinuation#5949

Merged
snakefoot merged 1 commit intoNLog:devfrom
snakefoot:cleanup_obsolete
Jan 31, 2026
Merged

CallSiteLayoutRenderer - Obsolete CleanNamesOfAnonymousDelegates + CleanNamesOfAsyncContinuation#5949
snakefoot merged 1 commit intoNLog:devfrom
snakefoot:cleanup_obsolete

Conversation

@snakefoot
Copy link
Contributor

@snakefoot snakefoot commented Jul 26, 2025

Unit-tests on Linux frequently fails when CleanNamesOfAnonymousDelegates=false or CleanNamesOfAsyncContinuation=false when running on NET8 (instead of NET6)

  • LogAfterTaskRunAwait_CleanNamesOfAsyncContinuationsIsFalse_ShouldNotCleanNames

Maybe some new optimization in the NET8 JIT-compiler (inlines so cleanup is not needed)

  • Wait for NLog v6.1

See also #5923

@coderabbitai
Copy link

coderabbitai bot commented Jul 26, 2025

Walkthrough

Two boolean properties on CallSiteLayoutRenderer were marked obsolete and hidden from editor browsing; all usages are wrapped with pragma directives to suppress obsolete warnings. Unit tests were updated to remove explicit uses and test cases for these options.

Changes

Cohort / File(s) Change Summary
Layout renderer
src/NLog/LayoutRenderers/CallSiteLayoutRenderer.cs
Marked CleanNamesOfAnonymousDelegates and CleanNamesOfAsyncContinuations with [Obsolete(...)] and [EditorBrowsable(...)]; added #pragma warning disable CS0618 / restore around their usages.
Unit tests
tests/NLog.UnitTests/LayoutRenderers/CallSiteTests.cs
Removed explicit layout flags and test cases referencing the deprecated properties; updated remaining tests to rely on defaults and adjusted layout strings/expectations.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

A rabbit nibbles old flags away,
Marks them obsolete, then hops to play.
Warnings muted, tests trimmed down light,
Code stays steady by moonlit night.
🥕

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

♻️ Duplicate comments (1)
tests/NLog.UnitTests/LayoutRenderers/CallSiteTests.cs (1)

1197-1197: Same naming nit as above

See comment on Line 1167 about dropping “IsTrue” from the test method name for clarity.

🧹 Nitpick comments (1)
tests/NLog.UnitTests/LayoutRenderers/CallSiteTests.cs (1)

1167-1167: Consider renaming test to remove “IsTrue” from its name

With the option hidden/obsolete and defaults doing the cleaning, the method name LogAfterTaskRunAwait_CleanNamesOfAsyncContinuationsIsTrue_ShouldCleanMethodName can be shortened (e.g., LogAfterTaskRunAwait_ShouldCleanMethodName) to avoid implying a tunable setting.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 030519f and 53cbb75.

📒 Files selected for processing (2)
  • src/NLog/LayoutRenderers/CallSiteLayoutRenderer.cs (6 hunks)
  • tests/NLog.UnitTests/LayoutRenderers/CallSiteTests.cs (5 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/NLog/LayoutRenderers/CallSiteLayoutRenderer.cs
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: task-list-completed
  • GitHub Check: task-list-completed
🔇 Additional comments (5)
tests/NLog.UnitTests/LayoutRenderers/CallSiteTests.cs (5)

415-415: LGTM: removed obsolete cleaning flag; class-only callsite remains correct

The updated layout ${callsite:ClassName=true:MethodName=false} matches the test assertion intent and avoids obsolete configuration.


448-448: LGTM: removed obsolete cleaning flag with IncludeNamespace override

${callsite:ClassName=true:MethodName=false:IncludeNamespace=false} preserves the previous semantics while no longer referencing the obsolete option.


1167-1167: LGTM: rely on default async-continuation cleaning

Dropping cleannamesofasynccontinuations and using ${callsite:classname=false} aligns with the obsoletion and keeps the assertion stable.


1197-1197: LGTM: remove obsolete async-continuation flag; class name + namespace case remains covered

${callsite:classname=true:includenamespace=true} is the right replacement and matches the expectation.


382-382: ✅ No remaining obsolete CallSite flags detected – Ready to merge.

A project-wide search confirms that all references to the now-obsolete CleanNamesOfAnonymousDelegates and CleanNamesOfAsyncContinuations flags exist only as:

  • Obsolete properties in src/NLog/LayoutRenderers/CallSiteLayoutRenderer.cs (marked with [Obsolete] and left with their default true values for backward compatibility).
  • Changelog entries in CHANGELOG.md documenting their deprecation.
  • Unit tests under tests/NLog.UnitTests/LayoutRenderers/CallSiteTests.cs that verify the default cleaning behavior (no tests set these flags to false).

No occurrences of these flags were found in XML/layout configurations, tests setting them to false, or any other code paths. All cleanup has been applied correctly.

@sonarqubecloud
Copy link

@snakefoot snakefoot merged commit 5571400 into NLog:dev Jan 31, 2026
5 of 6 checks passed
@snakefoot snakefoot added this to the 6.1 milestone Jan 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant