in ClrHeapAllocationsAnalyzer/ConcatenationAllocationAnalyzer.cs [64:76]
private static void CheckTypeConversion(TypeInfo typeInfo, Conversion conversionInfo, Action<Diagnostic> reportDiagnostic, Location location, string filePath) {
bool IsOptimizedValueType(ITypeSymbol type) {
return type.SpecialType == SpecialType.System_Boolean ||
type.SpecialType == SpecialType.System_Char ||
type.SpecialType == SpecialType.System_IntPtr ||
type.SpecialType == SpecialType.System_UIntPtr;
}
if (conversionInfo.IsBoxing && !IsOptimizedValueType(typeInfo.Type)) {
reportDiagnostic(Diagnostic.Create(ValueTypeToReferenceTypeInAStringConcatenationRule, location, new[] { typeInfo.Type.ToDisplayString() }));
HeapAllocationAnalyzerEventSource.Logger.BoxingAllocationInStringConcatenation(filePath);
}
}