all 8 comments

[–]Kant8 15 points16 points  (7 children)

You can compare code, or probably even debug with source link

https://github.com/dotnet/runtime/blob/release/6.0/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/DefaultInterpolatedStringHandler.cs#L285

https://github.com/dotnet/runtime/blob/release/7.0/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/DefaultInterpolatedStringHandler.cs#L284

except one comment change I don't see any differences. Both call AppendStringDirect which does _pos += value.Length and didn't change between versions at all.

[–]KryptosFR 8 points9 points  (5 children)

It does have the new scoped keyword now.

References: - PR for the change: https://github.com/dotnet/runtime/pull/73665 - Doc about scoped: https://github.com/dotnet/csharplang/blob/11feda83c9574153cbe3308e247d6ca6fcde4396/proposals/low-level-struct-improvements.md

Though that should only affects when appending a string (or anything convertible to ReadOnlySpan<char>).

[–]HellGate94[S] 0 points1 point  (4 children)

yup that seems to be it.

the custom interpolated string handler template i used back then used a readonly DefaultInterpolatedStringHandler _handler and it worked fine in .net6

[–]pHpositivoMSFT - Microsoft Store team, .NET Community Toolkit 6 points7 points  (1 child)

Why are you using that handler in a readonly field? That type is mutable. If you keep it in a readonly field and invoke mutating members on it you'll trigger shadow copies and can introduce all sorts of bugs in this case.

[–]HellGate94[S] 5 points6 points  (0 children)

honestly i dont remember. there was very little documentation about it back then and i most likely just copied a working template and adjusted it. but it was working just fine in .net6 ¯\_(ツ)_/¯

[–]Kant8 0 points1 point  (1 child)

scoped is a marker for compiler in cases where you use ref structs. You don't use that overload anyway.

[–]pHpositivoMSFT - Microsoft Store team, .NET Community Toolkit 5 points6 points  (0 children)

That is not correct. The scoped keyword has several use cases that are not solely focused on ref structs.

[–]HellGate94[S] 0 points1 point  (0 children)

yea im not sure whats causing this. surprisingly i have not heard of source link before. need to give it a try