C#: Bugfix in the implicittostring. Need to handle the ReadOnlySpan params overload for string.Format.

This commit is contained in:
Michael Nebel
2025-12-10 14:00:20 +01:00
parent ee5c291c9d
commit 298e8f0c58

View File

@@ -3,6 +3,7 @@
*/
import csharp
private import semmle.code.csharp.commons.Collections
private import semmle.code.csharp.frameworks.Format
private import semmle.code.csharp.frameworks.System
private import semmle.code.csharp.frameworks.system.Text
@@ -33,7 +34,7 @@ class ImplicitToStringExpr extends Expr {
or
p instanceof StringFormatItemParameter and
not p.getType() =
any(ArrayType at |
any(ParamsCollectionType at |
at.getElementType() instanceof ObjectType and
this.getType().isImplicitlyConvertibleTo(at)
)