LiteralWithRawValueLayoutRenderer - Only support RawValue when possible#6091
LiteralWithRawValueLayoutRenderer - Only support RawValue when possible#6091
Conversation
|
Caution Review failedThe pull request is closed. WalkthroughRemoved the raw-value success flag from LiteralWithRawValueLayoutRenderer and added [AppDomainFixedOutput]; IRawValue.TryGetRawValue now always returns true and returns the stored raw value. LayoutParser restricts conversions to types marked with AppDomainFixedOutput and updates literal merging. SimpleLayout ctor no longer explicitly nulls several fields. Changes
Sequence Diagram(s)sequenceDiagram
participant Parser as LayoutParser
participant Renderer as LayoutRenderer (candidate)
participant RawIfc as IRawValue
participant LiteralRaw as LiteralWithRawValueLayoutRenderer
participant LiteralStr as LiteralLayoutRenderer
Parser->>Renderer: CanBeConvertedToLiteral (check AppDomainFixedOutput)
alt Renderer implements IRawValue and has AppDomainFixedOutput
Parser->>RawIfc: TryGetRawValue()
RawIfc-->>Parser: (true, rawValue)
Parser->>LiteralRaw: construct(text, rawValue)
else missing AppDomainFixedOutput or no raw value
Parser->>LiteralStr: construct(text)
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 1 | ❌ 3❌ Failed checks (2 warnings, 1 inconclusive)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
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. Comment |
b99cacf to
c492587
Compare
b245a1f to
ad2b0cc
Compare
b52d537 to
2468b65
Compare
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/NLog/LayoutRenderers/LiteralWithRawValueLayoutRenderer.cs (1)
49-49: Nit: xmldoc<see cref>references the base class instead of this class.Pre-existing issue, but the doc comment says
LiteralLayoutRendererwhen it should sayLiteralWithRawValueLayoutRenderer.📝 Suggested fix
- /// Initializes a new instance of the <see cref="LiteralLayoutRenderer" /> class. + /// Initializes a new instance of the <see cref="LiteralWithRawValueLayoutRenderer" /> class.
2468b65 to
63306ba
Compare
527fa7b to
d33a0bd
Compare
|
@coderabbitai full review |
✅ Actions performedFull review triggered. |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@src/NLog/Layouts/LayoutParser.cs`:
- Around line 693-704: The concatenation currently appends to the old lr1
instance after replacing list[i - 1] with a new LiteralLayoutRenderer when lr1
is a LiteralWithRawValueLayoutRenderer, causing the new list entry to miss the
appended text; update the merge logic in LayoutParser's loop so you append to
the actual stored renderer (e.g., rebind lr1 = (LiteralLayoutRenderer)list[i -
1] after creating the replacement, or perform the concatenation against list[i -
1].Text) before removing list[i], and ensure you only mutate the object
referenced in the list (references: LiteralLayoutRenderer,
LiteralWithRawValueLayoutRenderer, variables lr1 and lr2).
a12b886 to
220c22b
Compare
|
220c22b to
30c64e2
Compare



No description provided.