Skip to content

Conversation

@snakefoot
Copy link
Contributor

@snakefoot snakefoot commented Nov 16, 2025

Followup to #5697

@snakefoot snakefoot added the enhancement Improvement on existing feature label Nov 16, 2025
@coderabbitai
Copy link

coderabbitai bot commented Nov 16, 2025

Walkthrough

The change refactors WriteAsyncLogEvent to centralize async continuation wrapping by invoking PreventMultipleCalls once at the method's start, creating a wrapped log event, and consistently reusing it across initialization failure and success code paths instead of duplicating wrapping logic.

Changes

Cohort / File(s) Summary
Async Continuation Wrapping Consolidation
src/NLog/Targets/Target.cs
Centralizes continuation wrapping at the start of WriteAsyncLogEvent, eliminates duplicate wrapping invocations, and applies the wrapped continuation to a new log event used throughout initialization and error handling paths.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

  • Key attention area: Verify that wrappedLogEvent is correctly constructed and that the wrapped continuation is properly applied across all code paths (initialization failure, initialization success, and standard execution).
  • Concern: Ensure the refactoring doesn't inadvertently change behavior by comparing how the continuation was previously applied in duplicate locations versus the consolidated approach.

Poem

🐰 A hop through the logic, so clean and so tight,
One wrapping, one path, no duplication blight,
The continuation now flows without repeat,
Prevention of calls makes the logic complete! 🎯

Pre-merge checks and finishing touches

❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Description check ❓ Inconclusive The pull request has no description provided by the author. Add a description explaining the purpose and scope of the changes related to PreventMultipleCalls enforcement when WriteFailedNotInitialized.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: enforcing PreventMultipleCalls wrapping when WriteFailedNotInitialized is called, which aligns with the PR's core objective.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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 changed the title Target enforce PreventMultipleCalls when WriteFailedNotInitialized Target also enforce PreventMultipleCalls when WriteFailedNotInitialized Nov 16, 2025
@sonarqubecloud
Copy link

@snakefoot snakefoot merged commit a27d341 into NLog:dev Nov 16, 2025
5 of 6 checks passed
@snakefoot snakefoot added this to the 6.0.7 milestone Nov 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Improvement on existing feature size/XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant