diff --git a/docs/compilers/CSharp/Compiler Breaking Changes - DotNet 9.md b/docs/compilers/CSharp/Compiler Breaking Changes - DotNet 9.md index 18c53677ef6ba..b55219afc9584 100644 --- a/docs/compilers/CSharp/Compiler Breaking Changes - DotNet 9.md +++ b/docs/compilers/CSharp/Compiler Breaking Changes - DotNet 9.md @@ -2,11 +2,13 @@ ## .editorconfig values no longer support trailing comments -***Introduced in Visual Studio 2022 version [TBD]*** +***Introduced in Visual Studio 2022 version 17.[TBD]*** The compiler is updated based on the EditorConfig specification clarification in -[editorconfig/specification#31](https://github.com/editorconfig/specification/pull/31). This changes the way values are -passed to analyzers for lines with the following form: +[editorconfig/specification#31](https://github.com/editorconfig/specification/pull/31). Following this change, comments +in **.editorconfig** and **.globalconfig** files must now appear on their own line. Comments which appear at the end of +a property value are now treated as part of the property value itself. This changes the way values are passed to +analyzers for lines with the following form: ```ini [*.cs] @@ -16,7 +18,7 @@ key2 = value2 ; text2 The following table shows how this change affects values passed to analyzers: -| EditorConfig line | New compiler interpretation | Old interpretation | -| ----------------- | --------------------------- | ------------------ | -| `key = value # text` | `value # text` | `value` | -| `key2 = value2 ; text2` | `value2 ; text2` | `value2` | +| EditorConfig line | New compiler interpretation | Old interpretation | +| ----------------------- | --------------------------- | ------------------ | +| `key = value # text` | `value # text` | `value` | +| `key2 = value2 ; text2` | `value2 ; text2` | `value2` | diff --git a/src/Compilers/Core/CodeAnalysisTest/Analyzers/AnalyzerConfigTests.cs b/src/Compilers/Core/CodeAnalysisTest/Analyzers/AnalyzerConfigTests.cs index 8015127cc8470..368e8df9310b4 100644 --- a/src/Compilers/Core/CodeAnalysisTest/Analyzers/AnalyzerConfigTests.cs +++ b/src/Compilers/Core/CodeAnalysisTest/Analyzers/AnalyzerConfigTests.cs @@ -1003,12 +1003,13 @@ public void EditorConfigToDiagnosticsIgnoresCommentLikeText(string delimiter) configs.Add(Parse($@" [*.cs] dotnet_diagnostic.cs000.severity = error {delimiter} ignored text +dotnet_diagnostic.cs001.severity = warning {delimiter} ignored text ", "/.editorconfig")); var options = GetAnalyzerConfigOptions(["/test.cs"], configs); configs.Free(); - Assert.Equal([CreateImmutableDictionary(("cs000", ReportDiagnostic.Error))], Array.ConvertAll(options, o => o.TreeOptions)); + Assert.Equal([CreateImmutableDictionary(("cs000", ReportDiagnostic.Error), ("cs001", ReportDiagnostic.Warn))], Array.ConvertAll(options, o => o.TreeOptions)); } [Fact]