controlflow / resharper-heapview

ReSharper Heap Allocations Viewer plugin
MIT License
303 stars 28 forks source link

string.format $"{}" boxing warning in C#10 #109

Closed HaydenReeve closed 1 year ago

HaydenReeve commented 1 year ago

var newFeature = $"Formatting a string with a reference type and a {valueType} in C#10 should not result in a case of boxing."

https://devblogs.microsoft.com/dotnet/string-interpolation-in-c-10-and-net-6/

controlflow commented 1 year ago

Hi. Can you please provide any example of the false positive boxing report? HeapView is aware of this compiler optimization, no boxing is reported: image

HaydenReeve commented 1 year ago

Hello 👋

My apologies for the delay in getting back to you.

I believe the false positive may in fact be a positive value after all—we're working on a legacy project in the middle of a highly awkward upwards migration and I think that there's some unsupported movement in the framework and c# version control that may be causing this issue.

Thankfully, that makes it my problem and not yours.

Sorry about that—but thank you for your diligent response. Appreciate your hard work!