Skip to content

Fix invalid C# version diagnostic message in config source generator #94893

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ private static class DiagnosticDescriptors
public static DiagnosticDescriptor LanguageVersionNotSupported { get; } = DiagnosticDescriptorHelper.Create(
id: "SYSLIB1102",
title: new LocalizableResourceString(nameof(SR.LanguageVersionIsNotSupportedTitle), SR.ResourceManager, typeof(FxResources.Microsoft.Extensions.Configuration.Binder.SourceGeneration.SR)),
messageFormat: new LocalizableResourceString(nameof(SR.Language_VersionIsNotSupportedMessageFormat), SR.ResourceManager, typeof(FxResources.Microsoft.Extensions.Configuration.Binder.SourceGeneration.SR)),
messageFormat: new LocalizableResourceString(nameof(SR.LanguageVersionIsNotSupportedMessageFormat), SR.ResourceManager, typeof(FxResources.Microsoft.Extensions.Configuration.Binder.SourceGeneration.SR)),
category: ProjectName,
defaultSeverity: DiagnosticSeverity.Error,
isEnabledByDefault: true);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
<!--
Microsoft ResX Schema

Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes

The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.

Example:

... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
Expand All @@ -26,36 +26,36 @@
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple

There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the

Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not

The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can

Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.

mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.

mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.

mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
Expand Down Expand Up @@ -132,7 +132,7 @@
<data name="ElementTypeNotSupported" xml:space="preserve">
<value>The collection element type is not supported: '{0}'.</value>
</data>
<data name="Language VersionIsNotSupportedMessageFormat" xml:space="preserve">
<data name="LanguageVersionIsNotSupportedMessageFormat" xml:space="preserve">
<value>The project's language version has to be at least 'C# 12'.</value>
</data>
<data name="LanguageVersionIsNotSupportedTitle" xml:space="preserve">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
<target state="translated">Typ elementu kolekce se nepodporuje: {0}“.</target>
<note />
</trans-unit>
<trans-unit id="Language VersionIsNotSupportedMessageFormat">
<trans-unit id="LanguageVersionIsNotSupportedMessageFormat">
<source>The project's language version has to be at least 'C# 12'.</source>
<target state="needs-review-translation">Jazyková verze projektu musí být alespoň C# 11</target>
<target state="new">The project's language version has to be at least 'C# 12'.</target>
<note />
</trans-unit>
<trans-unit id="LanguageVersionIsNotSupportedTitle">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
<target state="translated">Der Auflistungselementtyp wird nicht unterstützt: "{0}".</target>
<note />
</trans-unit>
<trans-unit id="Language VersionIsNotSupportedMessageFormat">
<trans-unit id="LanguageVersionIsNotSupportedMessageFormat">
<source>The project's language version has to be at least 'C# 12'.</source>
<target state="needs-review-translation">Die Sprachversion des Projekts muss mindestens „C# 11“ sein</target>
<target state="new">The project's language version has to be at least 'C# 12'.</target>
<note />
</trans-unit>
<trans-unit id="LanguageVersionIsNotSupportedTitle">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
<target state="translated">No se admite el tipo de elemento de colección: "{0}".</target>
<note />
</trans-unit>
<trans-unit id="Language VersionIsNotSupportedMessageFormat">
<trans-unit id="LanguageVersionIsNotSupportedMessageFormat">
<source>The project's language version has to be at least 'C# 12'.</source>
<target state="needs-review-translation">La versión del lenguaje del proyecto debe ser al menos "C# 11".</target>
<target state="new">The project's language version has to be at least 'C# 12'.</target>
<note />
</trans-unit>
<trans-unit id="LanguageVersionIsNotSupportedTitle">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
<target state="translated">Le type d‘élément collection n‘est pas pris en charge : ‘{0}‘.</target>
<note />
</trans-unit>
<trans-unit id="Language VersionIsNotSupportedMessageFormat">
<trans-unit id="LanguageVersionIsNotSupportedMessageFormat">
<source>The project's language version has to be at least 'C# 12'.</source>
<target state="needs-review-translation">La version de langage du projet doit être au moins « C# 11 ».</target>
<target state="new">The project's language version has to be at least 'C# 12'.</target>
<note />
</trans-unit>
<trans-unit id="LanguageVersionIsNotSupportedTitle">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
<target state="translated">Il tipo di elemento della raccolta non è supportato: '{0}'.</target>
<note />
</trans-unit>
<trans-unit id="Language VersionIsNotSupportedMessageFormat">
<trans-unit id="LanguageVersionIsNotSupportedMessageFormat">
<source>The project's language version has to be at least 'C# 12'.</source>
<target state="needs-review-translation">La versione del linguaggio del progetto deve essere almeno 'C# 11'.</target>
<target state="new">The project's language version has to be at least 'C# 12'.</target>
<note />
</trans-unit>
<trans-unit id="LanguageVersionIsNotSupportedTitle">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
<target state="translated">コレクション要素型はサポートされていません: '{0}'。</target>
<note />
</trans-unit>
<trans-unit id="Language VersionIsNotSupportedMessageFormat">
<trans-unit id="LanguageVersionIsNotSupportedMessageFormat">
<source>The project's language version has to be at least 'C# 12'.</source>
<target state="needs-review-translation">プロジェクトの言語バージョンは少なくとも 'C# 11' である必要があります。</target>
<target state="new">The project's language version has to be at least 'C# 12'.</target>
<note />
</trans-unit>
<trans-unit id="LanguageVersionIsNotSupportedTitle">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
<target state="translated">컬렉션 요소 유형이 지원되지 않습니다: '{0}'.</target>
<note />
</trans-unit>
<trans-unit id="Language VersionIsNotSupportedMessageFormat">
<trans-unit id="LanguageVersionIsNotSupportedMessageFormat">
<source>The project's language version has to be at least 'C# 12'.</source>
<target state="needs-review-translation">프로젝트의 언어 버전은 'C# 11' 이상이어야 합니다.</target>
<target state="new">The project's language version has to be at least 'C# 12'.</target>
<note />
</trans-unit>
<trans-unit id="LanguageVersionIsNotSupportedTitle">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
<target state="translated">Typ elementu kolekcji nie jest obsługiwany: „{0}”.</target>
<note />
</trans-unit>
<trans-unit id="Language VersionIsNotSupportedMessageFormat">
<trans-unit id="LanguageVersionIsNotSupportedMessageFormat">
<source>The project's language version has to be at least 'C# 12'.</source>
<target state="needs-review-translation">Wersja językowa projektu musi mieć wartość co najmniej „C# 11”.</target>
<target state="new">The project's language version has to be at least 'C# 12'.</target>
<note />
</trans-unit>
<trans-unit id="LanguageVersionIsNotSupportedTitle">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
<target state="translated">O tipo de elemento da coleção não é suportado: '{0}'.</target>
<note />
</trans-unit>
<trans-unit id="Language VersionIsNotSupportedMessageFormat">
<trans-unit id="LanguageVersionIsNotSupportedMessageFormat">
<source>The project's language version has to be at least 'C# 12'.</source>
<target state="needs-review-translation">A versão do idioma do projeto deve ser no mínimo 'C# 11'.</target>
<target state="new">The project's language version has to be at least 'C# 12'.</target>
<note />
</trans-unit>
<trans-unit id="LanguageVersionIsNotSupportedTitle">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
<target state="translated">Тип элемента коллекции не поддерживается: "{0}".</target>
<note />
</trans-unit>
<trans-unit id="Language VersionIsNotSupportedMessageFormat">
<trans-unit id="LanguageVersionIsNotSupportedMessageFormat">
<source>The project's language version has to be at least 'C# 12'.</source>
<target state="needs-review-translation">Версия языка проекта должна быть не ниже "C# 11".</target>
<target state="new">The project's language version has to be at least 'C# 12'.</target>
<note />
</trans-unit>
<trans-unit id="LanguageVersionIsNotSupportedTitle">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
<target state="translated">Koleksiyon öğesi türü desteklenmiyor: '{0}'.</target>
<note />
</trans-unit>
<trans-unit id="Language VersionIsNotSupportedMessageFormat">
<trans-unit id="LanguageVersionIsNotSupportedMessageFormat">
<source>The project's language version has to be at least 'C# 12'.</source>
<target state="needs-review-translation">Projenin dil sürümü en az 'C# 11' olmalıdır.</target>
<target state="new">The project's language version has to be at least 'C# 12'.</target>
<note />
</trans-unit>
<trans-unit id="LanguageVersionIsNotSupportedTitle">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
<target state="translated">不支持此集合元素类型: '{0}'。</target>
<note />
</trans-unit>
<trans-unit id="Language VersionIsNotSupportedMessageFormat">
<trans-unit id="LanguageVersionIsNotSupportedMessageFormat">
<source>The project's language version has to be at least 'C# 12'.</source>
<target state="needs-review-translation">项目的语言版本必须至少为 "C# 11"。</target>
<target state="new">The project's language version has to be at least 'C# 12'.</target>
<note />
</trans-unit>
<trans-unit id="LanguageVersionIsNotSupportedTitle">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
<target state="translated">不支援集合元素類型: '{0}'。</target>
<note />
</trans-unit>
<trans-unit id="Language VersionIsNotSupportedMessageFormat">
<trans-unit id="LanguageVersionIsNotSupportedMessageFormat">
<source>The project's language version has to be at least 'C# 12'.</source>
<target state="needs-review-translation">專案的語言版本必須至少為 'C# 11'。</target>
<target state="new">The project's language version has to be at least 'C# 12'.</target>
<note />
</trans-unit>
<trans-unit id="LanguageVersionIsNotSupportedTitle">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public async Task LangVersionMustBeCharp12OrHigher(LanguageVersion langVersion)

Diagnostic diagnostic = Assert.Single(result.Diagnostics);
Assert.True(diagnostic.Id == "SYSLIB1102");
Assert.Contains("C# 12", diagnostic.Descriptor.MessageFormat.ToString(CultureInfo.InvariantCulture));
Assert.Contains("C# 12", diagnostic.Descriptor.Title.ToString(CultureInfo.InvariantCulture));
Assert.Equal(DiagnosticSeverity.Error, diagnostic.Severity);
}
Expand Down