Skip to content

Conversation

@wuke32767
Copy link
Contributor

after i read the source code of DefaultInterpolatedStringHandler, i think current LogInterpolatedStringHandler can not avoid string interpolation.
https://github.com/dotnet/runtime/blob/74cf618d63c3d092eb91a9bb00ba8152cc2dfc76/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/DefaultInterpolatedStringHandler.cs#L145-L156

@JaThePlayer
Copy link
Member

The out bool shouldLog is treated specially by the compiler and will completely bypass AppendLiteral/AppendFormatted calls if its false. Example from Everest.Boot decompiled:
image

@wuke32767
Copy link
Contributor Author

thanks, i did not investigated.

@wuke32767 wuke32767 closed this Dec 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants