Skip to content

SimpleLayout - Marked Renderers-property as obsolete - #6200

Merged
snakefoot merged 1 commit into
NLog:devfrom
snakefoot:ConfiguredNamedTargets
Aug 11, 2026
Merged

SimpleLayout - Marked Renderers-property as obsolete#6200
snakefoot merged 1 commit into
NLog:devfrom
snakefoot:ConfiguredNamedTargets

Conversation

@snakefoot

@snakefoot snakefoot commented May 31, 2026

Copy link
Copy Markdown
Contributor
  • Wait for NLog v6.2

Move away from ReadOnlyCollection to make NLog more AOT-friendly.

@snakefoot snakefoot added breaking behavior change Same API, different result and removed size/L labels May 31, 2026
@coderabbitai

coderabbitai Bot commented May 31, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: b7fe314e-de40-4098-a30b-16e601af8813

📥 Commits

Reviewing files that changed from the base of the PR and between 3cf1869 and a46cae4.

📒 Files selected for processing (9)
  • src/NLog/Layouts/SimpleLayout.cs
  • tests/NLog.UnitTests/Conditions/ConditionParserTests.cs
  • tests/NLog.UnitTests/Config/ExtensionTests.cs
  • tests/NLog.UnitTests/Config/TargetConfigurationTests.cs
  • tests/NLog.UnitTests/Config/VariableTests.cs
  • tests/NLog.UnitTests/LayoutRenderers/ExceptionTests.cs
  • tests/NLog.UnitTests/LayoutRenderers/Wrappers/CachedTests.cs
  • tests/NLog.UnitTests/LayoutRenderers/Wrappers/WhenEmptyTests.cs
  • tests/NLog.UnitTests/Layouts/SimpleLayoutParserTests.cs
🚧 Files skipped from review as they are similar to previous changes (9)
  • src/NLog/Layouts/SimpleLayout.cs
  • tests/NLog.UnitTests/LayoutRenderers/Wrappers/WhenEmptyTests.cs
  • tests/NLog.UnitTests/LayoutRenderers/Wrappers/CachedTests.cs
  • tests/NLog.UnitTests/Config/ExtensionTests.cs
  • tests/NLog.UnitTests/Conditions/ConditionParserTests.cs
  • tests/NLog.UnitTests/LayoutRenderers/ExceptionTests.cs
  • tests/NLog.UnitTests/Config/VariableTests.cs
  • tests/NLog.UnitTests/Config/TargetConfigurationTests.cs
  • tests/NLog.UnitTests/Layouts/SimpleLayoutParserTests.cs

Walkthrough

Mark SimpleLayout.Renderers obsolete and update unit tests to access renderer pipelines via LayoutRenderers (using First(), ElementAt(), Single()) with System.Linq imports where required.

Changes

SimpleLayout.Renderers Deprecation and Test Migration

Layer / File(s) Summary
Mark SimpleLayout.Renderers as obsolete
src/NLog/Layouts/SimpleLayout.cs
The Renderers property is decorated with [Obsolete("Use LayoutRenderers property instead. Marked obsolete with NLog 6.2")] and [EditorBrowsable(EditorBrowsableState.Never)].
Update unit tests to use LayoutRenderers
tests/NLog.UnitTests/Conditions/ConditionParserTests.cs, tests/NLog.UnitTests/Config/ExtensionTests.cs, tests/NLog.UnitTests/Config/TargetConfigurationTests.cs, tests/NLog.UnitTests/Config/VariableTests.cs, tests/NLog.UnitTests/LayoutRenderers/ExceptionTests.cs, tests/NLog.UnitTests/LayoutRenderers/Wrappers/CachedTests.cs, tests/NLog.UnitTests/LayoutRenderers/Wrappers/WhenEmptyTests.cs, tests/NLog.UnitTests/Layouts/SimpleLayoutParserTests.cs
All tests replace layout.Renderers[...] indexer access with layout.LayoutRenderers access patterns (Assert.Single, First(), ElementAt(...), Count()); using System.Linq; added where LINQ is used.

🎯 2 (Simple) | ⏱️ ~10 minutes

"🐰 I nudged the hop, old Renderers made to rest,
LayoutRenderers now lead the test,
First() and Single() hop in line,
ElementAt keeps order fine,
A tidy migrate — carrot cake to fest!"

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 2.44% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: marking the Renderers property on SimpleLayout as obsolete, which is the primary modification to the public API.
Description check ✅ Passed The description is directly related to the changeset, mentioning both the obsolescence of the Renderers property and the motivation (AOT-friendliness), though it includes a deferred implementation checkbox.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

Comment @coderabbitai help to get the list of available commands and usage tips.

@snakefoot
snakefoot force-pushed the ConfiguredNamedTargets branch 2 times, most recently from bf362f3 to 3cf1869 Compare May 31, 2026 09:05
@snakefoot
snakefoot force-pushed the ConfiguredNamedTargets branch from 3cf1869 to a46cae4 Compare May 31, 2026 09:57
@sonarqubecloud

Copy link
Copy Markdown

@snakefoot snakefoot added this to the 6.2 milestone Jun 25, 2026
@snakefoot
snakefoot merged commit 5de0f35 into NLog:dev Aug 11, 2026
5 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking behavior change Same API, different result size/L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant