microsoft / sarif-sdk

.NET code and supporting files for working with the 'Static Analysis Results Interchange Format' (SARIF, see https://github.com/oasis-tcs/sarif-spec)
Other
189 stars 88 forks source link

Message string needs to escape curly braces #2814

Open yane3628 opened 2 weeks ago

yane3628 commented 2 weeks ago

When using GetMessageText in SarifExtensionMethods, I am getting "System.FormatException: Input string was not in a correct format". It seems that this is being thrown by string.Format in GetFormattedMessage.

The value for formatString should escape any curly braces that are not in the format {int} to avoid this error.

See Remarks for string.Format

KalleOlaviNiemitalo commented 1 week ago

According to [SARIF-v2.1.0-Errata01] §3.11.5 Messages with placeholders, the SARIF producer shall double the curly braces.