resharper-heapview
resharper-heapview copied to clipboard
Incorrect boxing highlight for string concatenation and modern compilers
The code var x = "Hello " + longValue
will show a highlight for boxing of the longValue
variable. It appears previous compilers would box the value and call String.Concat(object, object)
. Modern compilers will call longValue.ToString()
and then call String.Concat(string, string)
myPrimitive.ToString()
will still allocate a string
object, if it hasn't been interned, right? In any case, if modern compilers skip the boxing then the plugin's message at least is incorrect.
Partially fixed, boxing is not reported now. Will report implicit .ToString() invocation
Both allocations are now reported:
Boxing is eliminated, but implicit .ToString()
call still allocates a new string (at least for BCL's numeric types)