Version Used:
4.10.0
Steps to Reproduce:
- Create a program that has a field marked as something that is not json by using a [StringSyntax] attribute,
- Look at the highlighted text in the IDE.
Example program:
using System.Diagnostics.CodeAnalysis;
class Program
{
[StringSyntax("notjson")]
private string field;
void Goo()
{
// The JSON constant below is highlighted as json:
this.field = @"[{ 'goo': 0}]";
}
}
A minimal repro, with source-code provided, is ideal. Using sharplab is preferred for compiler/language issues whenever possible.
Diagnostic Id:
If this is a report about a bug in an analyzer, please include the diagnostic ID and message if possible (e.g. "IDE0030: Use coalesce expression").
Expected Behavior:
The constant string is not highlighted as JSON.
Actual Behavior:
The constant string is highlighted as JSON.
A PR was created for this issue: #74019