From 22e25fa181d372db35eb8cf813fb40944bffeda7 Mon Sep 17 00:00:00 2001 From: Maryam Ariyan Date: Wed, 12 May 2021 17:00:24 -0700 Subject: [PATCH 1/2] Improve logging source generator error messages Fixes: #52221 --- .../gen/DiagnosticDescriptors.cs | 2 +- .../gen/LoggerMessageGenerator.Parser.cs | 2 +- .../gen/Resources/Strings.resx | 8 ++++++-- .../gen/Resources/xlf/Strings.cs.xlf | 13 +++++++++---- .../gen/Resources/xlf/Strings.de.xlf | 13 +++++++++---- .../gen/Resources/xlf/Strings.es.xlf | 13 +++++++++---- .../gen/Resources/xlf/Strings.fr.xlf | 13 +++++++++---- .../gen/Resources/xlf/Strings.it.xlf | 13 +++++++++---- .../gen/Resources/xlf/Strings.ja.xlf | 13 +++++++++---- .../gen/Resources/xlf/Strings.ko.xlf | 13 +++++++++---- .../gen/Resources/xlf/Strings.pl.xlf | 13 +++++++++---- .../gen/Resources/xlf/Strings.pt-BR.xlf | 13 +++++++++---- .../gen/Resources/xlf/Strings.ru.xlf | 13 +++++++++---- .../gen/Resources/xlf/Strings.tr.xlf | 13 +++++++++---- .../gen/Resources/xlf/Strings.zh-Hans.xlf | 13 +++++++++---- .../gen/Resources/xlf/Strings.zh-Hant.xlf | 13 +++++++++---- .../LoggerMessageGeneratorParserTests.cs | 2 ++ 17 files changed, 127 insertions(+), 56 deletions(-) diff --git a/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/DiagnosticDescriptors.cs b/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/DiagnosticDescriptors.cs index 9e51646b52f17e..2e7e0ac340180d 100644 --- a/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/DiagnosticDescriptors.cs +++ b/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/DiagnosticDescriptors.cs @@ -66,7 +66,7 @@ public static class DiagnosticDescriptors public static DiagnosticDescriptor MissingLoggerArgument { get; } = new DiagnosticDescriptor( id: "SYSLIB1008", - title: new LocalizableResourceString(nameof(SR.MissingLoggerArgumentMessage), SR.ResourceManager, typeof(FxResources.Microsoft.Extensions.Logging.Generators.SR)), + title: new LocalizableResourceString(nameof(SR.MissingLoggerArgumentTitle), SR.ResourceManager, typeof(FxResources.Microsoft.Extensions.Logging.Generators.SR)), messageFormat: new LocalizableResourceString(nameof(SR.MissingLoggerArgumentMessage), SR.ResourceManager, typeof(FxResources.Microsoft.Extensions.Logging.Generators.SR)), category: "LoggingGenerator", DiagnosticSeverity.Error, diff --git a/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/LoggerMessageGenerator.Parser.cs b/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/LoggerMessageGenerator.Parser.cs index b7a7beea720edf..03c5ad2cf57624 100644 --- a/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/LoggerMessageGenerator.Parser.cs +++ b/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/LoggerMessageGenerator.Parser.cs @@ -273,7 +273,7 @@ public IReadOnlyList GetLogClasses(IEnumerable Logging methods must return void + + One of the arguments to a static logging method must implement the Microsoft.Extensions.Logging.ILogger interface + {Locked="Microsoft.Extensions.Logging.ILogger"} + - One of the arguments to a logging method must implement the Microsoft.Extensions.Logging.ILogger interface + One of the arguments to the static logging method `{0}` must implement the Microsoft.Extensions.Logging.ILogger interface {Locked="Microsoft.Extensions.Logging.ILogger"} @@ -167,7 +171,7 @@ Redundant qualifier in logging message - Argument {0} is not referenced from the logging message + Argument `{0}` is not referenced from the logging message Argument is not referenced from the logging message diff --git a/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.cs.xlf b/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.cs.xlf index 044e1bd67633f0..475d7c2f6a0eb4 100644 --- a/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.cs.xlf +++ b/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.cs.xlf @@ -3,8 +3,8 @@ - Argument {0} is not referenced from the logging message - Argument {0} is not referenced from the logging message + Argument `{0}` is not referenced from the logging message + Argument `{0}` is not referenced from the logging message @@ -73,8 +73,13 @@ - One of the arguments to a logging method must implement the Microsoft.Extensions.Logging.ILogger interface - One of the arguments to a logging method must implement the Microsoft.Extensions.Logging.ILogger interface + One of the arguments to the static logging method `{0}` must implement the Microsoft.Extensions.Logging.ILogger interface + One of the arguments to the static logging method `{0}` must implement the Microsoft.Extensions.Logging.ILogger interface + {Locked="Microsoft.Extensions.Logging.ILogger"} + + + One of the arguments to a static logging method must implement the Microsoft.Extensions.Logging.ILogger interface + One of the arguments to a static logging method must implement the Microsoft.Extensions.Logging.ILogger interface {Locked="Microsoft.Extensions.Logging.ILogger"} diff --git a/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.de.xlf b/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.de.xlf index 258f697c492e26..e2317bef03f3c0 100644 --- a/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.de.xlf +++ b/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.de.xlf @@ -3,8 +3,8 @@ - Argument {0} is not referenced from the logging message - Argument {0} is not referenced from the logging message + Argument `{0}` is not referenced from the logging message + Argument `{0}` is not referenced from the logging message @@ -73,8 +73,13 @@ - One of the arguments to a logging method must implement the Microsoft.Extensions.Logging.ILogger interface - One of the arguments to a logging method must implement the Microsoft.Extensions.Logging.ILogger interface + One of the arguments to the static logging method `{0}` must implement the Microsoft.Extensions.Logging.ILogger interface + One of the arguments to the static logging method `{0}` must implement the Microsoft.Extensions.Logging.ILogger interface + {Locked="Microsoft.Extensions.Logging.ILogger"} + + + One of the arguments to a static logging method must implement the Microsoft.Extensions.Logging.ILogger interface + One of the arguments to a static logging method must implement the Microsoft.Extensions.Logging.ILogger interface {Locked="Microsoft.Extensions.Logging.ILogger"} diff --git a/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.es.xlf b/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.es.xlf index 0424989915dd77..1f6aa2b20e1c41 100644 --- a/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.es.xlf +++ b/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.es.xlf @@ -3,8 +3,8 @@ - Argument {0} is not referenced from the logging message - Argument {0} is not referenced from the logging message + Argument `{0}` is not referenced from the logging message + Argument `{0}` is not referenced from the logging message @@ -73,8 +73,13 @@ - One of the arguments to a logging method must implement the Microsoft.Extensions.Logging.ILogger interface - One of the arguments to a logging method must implement the Microsoft.Extensions.Logging.ILogger interface + One of the arguments to the static logging method `{0}` must implement the Microsoft.Extensions.Logging.ILogger interface + One of the arguments to the static logging method `{0}` must implement the Microsoft.Extensions.Logging.ILogger interface + {Locked="Microsoft.Extensions.Logging.ILogger"} + + + One of the arguments to a static logging method must implement the Microsoft.Extensions.Logging.ILogger interface + One of the arguments to a static logging method must implement the Microsoft.Extensions.Logging.ILogger interface {Locked="Microsoft.Extensions.Logging.ILogger"} diff --git a/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.fr.xlf b/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.fr.xlf index a482372783f57c..8af725c59be762 100644 --- a/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.fr.xlf +++ b/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.fr.xlf @@ -3,8 +3,8 @@ - Argument {0} is not referenced from the logging message - Argument {0} is not referenced from the logging message + Argument `{0}` is not referenced from the logging message + Argument `{0}` is not referenced from the logging message @@ -73,8 +73,13 @@ - One of the arguments to a logging method must implement the Microsoft.Extensions.Logging.ILogger interface - One of the arguments to a logging method must implement the Microsoft.Extensions.Logging.ILogger interface + One of the arguments to the static logging method `{0}` must implement the Microsoft.Extensions.Logging.ILogger interface + One of the arguments to the static logging method `{0}` must implement the Microsoft.Extensions.Logging.ILogger interface + {Locked="Microsoft.Extensions.Logging.ILogger"} + + + One of the arguments to a static logging method must implement the Microsoft.Extensions.Logging.ILogger interface + One of the arguments to a static logging method must implement the Microsoft.Extensions.Logging.ILogger interface {Locked="Microsoft.Extensions.Logging.ILogger"} diff --git a/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.it.xlf b/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.it.xlf index 304056d1bd69fd..0aac22d1b23dcb 100644 --- a/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.it.xlf +++ b/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.it.xlf @@ -3,8 +3,8 @@ - Argument {0} is not referenced from the logging message - Argument {0} is not referenced from the logging message + Argument `{0}` is not referenced from the logging message + Argument `{0}` is not referenced from the logging message @@ -73,8 +73,13 @@ - One of the arguments to a logging method must implement the Microsoft.Extensions.Logging.ILogger interface - One of the arguments to a logging method must implement the Microsoft.Extensions.Logging.ILogger interface + One of the arguments to the static logging method `{0}` must implement the Microsoft.Extensions.Logging.ILogger interface + One of the arguments to the static logging method `{0}` must implement the Microsoft.Extensions.Logging.ILogger interface + {Locked="Microsoft.Extensions.Logging.ILogger"} + + + One of the arguments to a static logging method must implement the Microsoft.Extensions.Logging.ILogger interface + One of the arguments to a static logging method must implement the Microsoft.Extensions.Logging.ILogger interface {Locked="Microsoft.Extensions.Logging.ILogger"} diff --git a/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.ja.xlf b/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.ja.xlf index c8b172fd7630b6..3ded16d4cb516c 100644 --- a/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.ja.xlf +++ b/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.ja.xlf @@ -3,8 +3,8 @@ - Argument {0} is not referenced from the logging message - Argument {0} is not referenced from the logging message + Argument `{0}` is not referenced from the logging message + Argument `{0}` is not referenced from the logging message @@ -73,8 +73,13 @@ - One of the arguments to a logging method must implement the Microsoft.Extensions.Logging.ILogger interface - One of the arguments to a logging method must implement the Microsoft.Extensions.Logging.ILogger interface + One of the arguments to the static logging method `{0}` must implement the Microsoft.Extensions.Logging.ILogger interface + One of the arguments to the static logging method `{0}` must implement the Microsoft.Extensions.Logging.ILogger interface + {Locked="Microsoft.Extensions.Logging.ILogger"} + + + One of the arguments to a static logging method must implement the Microsoft.Extensions.Logging.ILogger interface + One of the arguments to a static logging method must implement the Microsoft.Extensions.Logging.ILogger interface {Locked="Microsoft.Extensions.Logging.ILogger"} diff --git a/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.ko.xlf b/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.ko.xlf index fdb53576c829ad..013c44f17853ed 100644 --- a/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.ko.xlf +++ b/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.ko.xlf @@ -3,8 +3,8 @@ - Argument {0} is not referenced from the logging message - Argument {0} is not referenced from the logging message + Argument `{0}` is not referenced from the logging message + Argument `{0}` is not referenced from the logging message @@ -73,8 +73,13 @@ - One of the arguments to a logging method must implement the Microsoft.Extensions.Logging.ILogger interface - One of the arguments to a logging method must implement the Microsoft.Extensions.Logging.ILogger interface + One of the arguments to the static logging method `{0}` must implement the Microsoft.Extensions.Logging.ILogger interface + One of the arguments to the static logging method `{0}` must implement the Microsoft.Extensions.Logging.ILogger interface + {Locked="Microsoft.Extensions.Logging.ILogger"} + + + One of the arguments to a static logging method must implement the Microsoft.Extensions.Logging.ILogger interface + One of the arguments to a static logging method must implement the Microsoft.Extensions.Logging.ILogger interface {Locked="Microsoft.Extensions.Logging.ILogger"} diff --git a/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.pl.xlf b/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.pl.xlf index 790fec15f6a669..67b8dda3f7939d 100644 --- a/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.pl.xlf +++ b/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.pl.xlf @@ -3,8 +3,8 @@ - Argument {0} is not referenced from the logging message - Argument {0} is not referenced from the logging message + Argument `{0}` is not referenced from the logging message + Argument `{0}` is not referenced from the logging message @@ -73,8 +73,13 @@ - One of the arguments to a logging method must implement the Microsoft.Extensions.Logging.ILogger interface - One of the arguments to a logging method must implement the Microsoft.Extensions.Logging.ILogger interface + One of the arguments to the static logging method `{0}` must implement the Microsoft.Extensions.Logging.ILogger interface + One of the arguments to the static logging method `{0}` must implement the Microsoft.Extensions.Logging.ILogger interface + {Locked="Microsoft.Extensions.Logging.ILogger"} + + + One of the arguments to a static logging method must implement the Microsoft.Extensions.Logging.ILogger interface + One of the arguments to a static logging method must implement the Microsoft.Extensions.Logging.ILogger interface {Locked="Microsoft.Extensions.Logging.ILogger"} diff --git a/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.pt-BR.xlf b/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.pt-BR.xlf index 1451df01554bbe..520106db3735ad 100644 --- a/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.pt-BR.xlf +++ b/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.pt-BR.xlf @@ -3,8 +3,8 @@ - Argument {0} is not referenced from the logging message - Argument {0} is not referenced from the logging message + Argument `{0}` is not referenced from the logging message + Argument `{0}` is not referenced from the logging message @@ -73,8 +73,13 @@ - One of the arguments to a logging method must implement the Microsoft.Extensions.Logging.ILogger interface - One of the arguments to a logging method must implement the Microsoft.Extensions.Logging.ILogger interface + One of the arguments to the static logging method `{0}` must implement the Microsoft.Extensions.Logging.ILogger interface + One of the arguments to the static logging method `{0}` must implement the Microsoft.Extensions.Logging.ILogger interface + {Locked="Microsoft.Extensions.Logging.ILogger"} + + + One of the arguments to a static logging method must implement the Microsoft.Extensions.Logging.ILogger interface + One of the arguments to a static logging method must implement the Microsoft.Extensions.Logging.ILogger interface {Locked="Microsoft.Extensions.Logging.ILogger"} diff --git a/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.ru.xlf b/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.ru.xlf index 66fbc83a6e6a94..91b54c35b2aa23 100644 --- a/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.ru.xlf +++ b/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.ru.xlf @@ -3,8 +3,8 @@ - Argument {0} is not referenced from the logging message - Argument {0} is not referenced from the logging message + Argument `{0}` is not referenced from the logging message + Argument `{0}` is not referenced from the logging message @@ -73,8 +73,13 @@ - One of the arguments to a logging method must implement the Microsoft.Extensions.Logging.ILogger interface - One of the arguments to a logging method must implement the Microsoft.Extensions.Logging.ILogger interface + One of the arguments to the static logging method `{0}` must implement the Microsoft.Extensions.Logging.ILogger interface + One of the arguments to the static logging method `{0}` must implement the Microsoft.Extensions.Logging.ILogger interface + {Locked="Microsoft.Extensions.Logging.ILogger"} + + + One of the arguments to a static logging method must implement the Microsoft.Extensions.Logging.ILogger interface + One of the arguments to a static logging method must implement the Microsoft.Extensions.Logging.ILogger interface {Locked="Microsoft.Extensions.Logging.ILogger"} diff --git a/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.tr.xlf b/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.tr.xlf index fc70ba858ab992..5c0c06adebdb83 100644 --- a/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.tr.xlf +++ b/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.tr.xlf @@ -3,8 +3,8 @@ - Argument {0} is not referenced from the logging message - Argument {0} is not referenced from the logging message + Argument `{0}` is not referenced from the logging message + Argument `{0}` is not referenced from the logging message @@ -73,8 +73,13 @@ - One of the arguments to a logging method must implement the Microsoft.Extensions.Logging.ILogger interface - One of the arguments to a logging method must implement the Microsoft.Extensions.Logging.ILogger interface + One of the arguments to the static logging method `{0}` must implement the Microsoft.Extensions.Logging.ILogger interface + One of the arguments to the static logging method `{0}` must implement the Microsoft.Extensions.Logging.ILogger interface + {Locked="Microsoft.Extensions.Logging.ILogger"} + + + One of the arguments to a static logging method must implement the Microsoft.Extensions.Logging.ILogger interface + One of the arguments to a static logging method must implement the Microsoft.Extensions.Logging.ILogger interface {Locked="Microsoft.Extensions.Logging.ILogger"} diff --git a/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.zh-Hans.xlf b/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.zh-Hans.xlf index 2cdeaa1133a21c..5a18bd8745a28c 100644 --- a/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.zh-Hans.xlf +++ b/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.zh-Hans.xlf @@ -3,8 +3,8 @@ - Argument {0} is not referenced from the logging message - Argument {0} is not referenced from the logging message + Argument `{0}` is not referenced from the logging message + Argument `{0}` is not referenced from the logging message @@ -73,8 +73,13 @@ - One of the arguments to a logging method must implement the Microsoft.Extensions.Logging.ILogger interface - One of the arguments to a logging method must implement the Microsoft.Extensions.Logging.ILogger interface + One of the arguments to the static logging method `{0}` must implement the Microsoft.Extensions.Logging.ILogger interface + One of the arguments to the static logging method `{0}` must implement the Microsoft.Extensions.Logging.ILogger interface + {Locked="Microsoft.Extensions.Logging.ILogger"} + + + One of the arguments to a static logging method must implement the Microsoft.Extensions.Logging.ILogger interface + One of the arguments to a static logging method must implement the Microsoft.Extensions.Logging.ILogger interface {Locked="Microsoft.Extensions.Logging.ILogger"} diff --git a/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.zh-Hant.xlf b/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.zh-Hant.xlf index 52f65573cda1e2..2f532e534f2df7 100644 --- a/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.zh-Hant.xlf +++ b/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.zh-Hant.xlf @@ -3,8 +3,8 @@ - Argument {0} is not referenced from the logging message - Argument {0} is not referenced from the logging message + Argument `{0}` is not referenced from the logging message + Argument `{0}` is not referenced from the logging message @@ -73,8 +73,13 @@ - One of the arguments to a logging method must implement the Microsoft.Extensions.Logging.ILogger interface - One of the arguments to a logging method must implement the Microsoft.Extensions.Logging.ILogger interface + One of the arguments to the static logging method `{0}` must implement the Microsoft.Extensions.Logging.ILogger interface + One of the arguments to the static logging method `{0}` must implement the Microsoft.Extensions.Logging.ILogger interface + {Locked="Microsoft.Extensions.Logging.ILogger"} + + + One of the arguments to a static logging method must implement the Microsoft.Extensions.Logging.ILogger interface + One of the arguments to a static logging method must implement the Microsoft.Extensions.Logging.ILogger interface {Locked="Microsoft.Extensions.Logging.ILogger"} diff --git a/src/libraries/Microsoft.Extensions.Logging.Abstractions/tests/Microsoft.Extensions.Logging.Generators.Tests/LoggerMessageGeneratorParserTests.cs b/src/libraries/Microsoft.Extensions.Logging.Abstractions/tests/Microsoft.Extensions.Logging.Generators.Tests/LoggerMessageGeneratorParserTests.cs index f8942e11b6140b..fe0b77239c9681 100644 --- a/src/libraries/Microsoft.Extensions.Logging.Abstractions/tests/Microsoft.Extensions.Logging.Generators.Tests/LoggerMessageGeneratorParserTests.cs +++ b/src/libraries/Microsoft.Extensions.Logging.Abstractions/tests/Microsoft.Extensions.Logging.Generators.Tests/LoggerMessageGeneratorParserTests.cs @@ -77,6 +77,7 @@ partial class C Assert.Single(diagnostics); Assert.Equal(DiagnosticDescriptors.ArgumentHasNoCorrespondingTemplate.Id, diagnostics[0].Id); + Assert.Contains("Argument `foo` is not referenced from the logging message", diagnostics[0].GetMessage(), StringComparison.InvariantCulture); } [Fact] @@ -395,6 +396,7 @@ partial class C Assert.Single(diagnostics); Assert.Equal(DiagnosticDescriptors.MissingLoggerArgument.Id, diagnostics[0].Id); + Assert.Contains("One of the arguments to the static logging method `M1` must implement the Microsoft.Extensions.Logging.ILogger interface", diagnostics[0].GetMessage(), StringComparison.InvariantCulture); } [Fact] From 03396843d15d9f61c88ec57e507461057bfc15d3 Mon Sep 17 00:00:00 2001 From: Maryam Ariyan Date: Thu, 13 May 2021 11:39:50 -0700 Subject: [PATCH 2/2] Apply PR feedback --- .../gen/Resources/Strings.resx | 4 ++-- .../gen/Resources/xlf/Strings.cs.xlf | 8 ++++---- .../gen/Resources/xlf/Strings.de.xlf | 8 ++++---- .../gen/Resources/xlf/Strings.es.xlf | 8 ++++---- .../gen/Resources/xlf/Strings.fr.xlf | 8 ++++---- .../gen/Resources/xlf/Strings.it.xlf | 8 ++++---- .../gen/Resources/xlf/Strings.ja.xlf | 8 ++++---- .../gen/Resources/xlf/Strings.ko.xlf | 8 ++++---- .../gen/Resources/xlf/Strings.pl.xlf | 8 ++++---- .../gen/Resources/xlf/Strings.pt-BR.xlf | 8 ++++---- .../gen/Resources/xlf/Strings.ru.xlf | 8 ++++---- .../gen/Resources/xlf/Strings.tr.xlf | 8 ++++---- .../gen/Resources/xlf/Strings.zh-Hans.xlf | 8 ++++---- .../gen/Resources/xlf/Strings.zh-Hant.xlf | 8 ++++---- .../LoggerMessageGeneratorParserTests.cs | 4 ++-- 15 files changed, 56 insertions(+), 56 deletions(-) diff --git a/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/Strings.resx b/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/Strings.resx index 031ab2181a62b3..13a23bcd2118b8 100644 --- a/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/Strings.resx +++ b/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/Strings.resx @@ -146,7 +146,7 @@ {Locked="Microsoft.Extensions.Logging.ILogger"} - One of the arguments to the static logging method `{0}` must implement the Microsoft.Extensions.Logging.ILogger interface + One of the arguments to the static logging method '{0}' must implement the Microsoft.Extensions.Logging.ILogger interface {Locked="Microsoft.Extensions.Logging.ILogger"} @@ -171,7 +171,7 @@ Redundant qualifier in logging message - Argument `{0}` is not referenced from the logging message + Argument '{0}' is not referenced from the logging message Argument is not referenced from the logging message diff --git a/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.cs.xlf b/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.cs.xlf index 475d7c2f6a0eb4..8a6e5be5b381c6 100644 --- a/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.cs.xlf +++ b/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.cs.xlf @@ -3,8 +3,8 @@ - Argument `{0}` is not referenced from the logging message - Argument `{0}` is not referenced from the logging message + Argument '{0}' is not referenced from the logging message + Argument '{0}' is not referenced from the logging message @@ -73,8 +73,8 @@ - One of the arguments to the static logging method `{0}` must implement the Microsoft.Extensions.Logging.ILogger interface - One of the arguments to the static logging method `{0}` must implement the Microsoft.Extensions.Logging.ILogger interface + One of the arguments to the static logging method '{0}' must implement the Microsoft.Extensions.Logging.ILogger interface + One of the arguments to the static logging method '{0}' must implement the Microsoft.Extensions.Logging.ILogger interface {Locked="Microsoft.Extensions.Logging.ILogger"} diff --git a/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.de.xlf b/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.de.xlf index e2317bef03f3c0..835dfbbc7fbf1a 100644 --- a/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.de.xlf +++ b/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.de.xlf @@ -3,8 +3,8 @@ - Argument `{0}` is not referenced from the logging message - Argument `{0}` is not referenced from the logging message + Argument '{0}' is not referenced from the logging message + Argument '{0}' is not referenced from the logging message @@ -73,8 +73,8 @@ - One of the arguments to the static logging method `{0}` must implement the Microsoft.Extensions.Logging.ILogger interface - One of the arguments to the static logging method `{0}` must implement the Microsoft.Extensions.Logging.ILogger interface + One of the arguments to the static logging method '{0}' must implement the Microsoft.Extensions.Logging.ILogger interface + One of the arguments to the static logging method '{0}' must implement the Microsoft.Extensions.Logging.ILogger interface {Locked="Microsoft.Extensions.Logging.ILogger"} diff --git a/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.es.xlf b/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.es.xlf index 1f6aa2b20e1c41..0db7b4e17b3667 100644 --- a/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.es.xlf +++ b/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.es.xlf @@ -3,8 +3,8 @@ - Argument `{0}` is not referenced from the logging message - Argument `{0}` is not referenced from the logging message + Argument '{0}' is not referenced from the logging message + Argument '{0}' is not referenced from the logging message @@ -73,8 +73,8 @@ - One of the arguments to the static logging method `{0}` must implement the Microsoft.Extensions.Logging.ILogger interface - One of the arguments to the static logging method `{0}` must implement the Microsoft.Extensions.Logging.ILogger interface + One of the arguments to the static logging method '{0}' must implement the Microsoft.Extensions.Logging.ILogger interface + One of the arguments to the static logging method '{0}' must implement the Microsoft.Extensions.Logging.ILogger interface {Locked="Microsoft.Extensions.Logging.ILogger"} diff --git a/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.fr.xlf b/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.fr.xlf index 8af725c59be762..757ff655a6b142 100644 --- a/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.fr.xlf +++ b/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.fr.xlf @@ -3,8 +3,8 @@ - Argument `{0}` is not referenced from the logging message - Argument `{0}` is not referenced from the logging message + Argument '{0}' is not referenced from the logging message + Argument '{0}' is not referenced from the logging message @@ -73,8 +73,8 @@ - One of the arguments to the static logging method `{0}` must implement the Microsoft.Extensions.Logging.ILogger interface - One of the arguments to the static logging method `{0}` must implement the Microsoft.Extensions.Logging.ILogger interface + One of the arguments to the static logging method '{0}' must implement the Microsoft.Extensions.Logging.ILogger interface + One of the arguments to the static logging method '{0}' must implement the Microsoft.Extensions.Logging.ILogger interface {Locked="Microsoft.Extensions.Logging.ILogger"} diff --git a/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.it.xlf b/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.it.xlf index 0aac22d1b23dcb..8717aa30c3c287 100644 --- a/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.it.xlf +++ b/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.it.xlf @@ -3,8 +3,8 @@ - Argument `{0}` is not referenced from the logging message - Argument `{0}` is not referenced from the logging message + Argument '{0}' is not referenced from the logging message + Argument '{0}' is not referenced from the logging message @@ -73,8 +73,8 @@ - One of the arguments to the static logging method `{0}` must implement the Microsoft.Extensions.Logging.ILogger interface - One of the arguments to the static logging method `{0}` must implement the Microsoft.Extensions.Logging.ILogger interface + One of the arguments to the static logging method '{0}' must implement the Microsoft.Extensions.Logging.ILogger interface + One of the arguments to the static logging method '{0}' must implement the Microsoft.Extensions.Logging.ILogger interface {Locked="Microsoft.Extensions.Logging.ILogger"} diff --git a/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.ja.xlf b/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.ja.xlf index 3ded16d4cb516c..9ed2e744c66a4c 100644 --- a/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.ja.xlf +++ b/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.ja.xlf @@ -3,8 +3,8 @@ - Argument `{0}` is not referenced from the logging message - Argument `{0}` is not referenced from the logging message + Argument '{0}' is not referenced from the logging message + Argument '{0}' is not referenced from the logging message @@ -73,8 +73,8 @@ - One of the arguments to the static logging method `{0}` must implement the Microsoft.Extensions.Logging.ILogger interface - One of the arguments to the static logging method `{0}` must implement the Microsoft.Extensions.Logging.ILogger interface + One of the arguments to the static logging method '{0}' must implement the Microsoft.Extensions.Logging.ILogger interface + One of the arguments to the static logging method '{0}' must implement the Microsoft.Extensions.Logging.ILogger interface {Locked="Microsoft.Extensions.Logging.ILogger"} diff --git a/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.ko.xlf b/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.ko.xlf index 013c44f17853ed..5b7bbb9010784c 100644 --- a/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.ko.xlf +++ b/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.ko.xlf @@ -3,8 +3,8 @@ - Argument `{0}` is not referenced from the logging message - Argument `{0}` is not referenced from the logging message + Argument '{0}' is not referenced from the logging message + Argument '{0}' is not referenced from the logging message @@ -73,8 +73,8 @@ - One of the arguments to the static logging method `{0}` must implement the Microsoft.Extensions.Logging.ILogger interface - One of the arguments to the static logging method `{0}` must implement the Microsoft.Extensions.Logging.ILogger interface + One of the arguments to the static logging method '{0}' must implement the Microsoft.Extensions.Logging.ILogger interface + One of the arguments to the static logging method '{0}' must implement the Microsoft.Extensions.Logging.ILogger interface {Locked="Microsoft.Extensions.Logging.ILogger"} diff --git a/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.pl.xlf b/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.pl.xlf index 67b8dda3f7939d..eed366ed41893d 100644 --- a/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.pl.xlf +++ b/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.pl.xlf @@ -3,8 +3,8 @@ - Argument `{0}` is not referenced from the logging message - Argument `{0}` is not referenced from the logging message + Argument '{0}' is not referenced from the logging message + Argument '{0}' is not referenced from the logging message @@ -73,8 +73,8 @@ - One of the arguments to the static logging method `{0}` must implement the Microsoft.Extensions.Logging.ILogger interface - One of the arguments to the static logging method `{0}` must implement the Microsoft.Extensions.Logging.ILogger interface + One of the arguments to the static logging method '{0}' must implement the Microsoft.Extensions.Logging.ILogger interface + One of the arguments to the static logging method '{0}' must implement the Microsoft.Extensions.Logging.ILogger interface {Locked="Microsoft.Extensions.Logging.ILogger"} diff --git a/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.pt-BR.xlf b/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.pt-BR.xlf index 520106db3735ad..c33ad19bb8cd91 100644 --- a/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.pt-BR.xlf +++ b/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.pt-BR.xlf @@ -3,8 +3,8 @@ - Argument `{0}` is not referenced from the logging message - Argument `{0}` is not referenced from the logging message + Argument '{0}' is not referenced from the logging message + Argument '{0}' is not referenced from the logging message @@ -73,8 +73,8 @@ - One of the arguments to the static logging method `{0}` must implement the Microsoft.Extensions.Logging.ILogger interface - One of the arguments to the static logging method `{0}` must implement the Microsoft.Extensions.Logging.ILogger interface + One of the arguments to the static logging method '{0}' must implement the Microsoft.Extensions.Logging.ILogger interface + One of the arguments to the static logging method '{0}' must implement the Microsoft.Extensions.Logging.ILogger interface {Locked="Microsoft.Extensions.Logging.ILogger"} diff --git a/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.ru.xlf b/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.ru.xlf index 91b54c35b2aa23..37548b1750a5cc 100644 --- a/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.ru.xlf +++ b/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.ru.xlf @@ -3,8 +3,8 @@ - Argument `{0}` is not referenced from the logging message - Argument `{0}` is not referenced from the logging message + Argument '{0}' is not referenced from the logging message + Argument '{0}' is not referenced from the logging message @@ -73,8 +73,8 @@ - One of the arguments to the static logging method `{0}` must implement the Microsoft.Extensions.Logging.ILogger interface - One of the arguments to the static logging method `{0}` must implement the Microsoft.Extensions.Logging.ILogger interface + One of the arguments to the static logging method '{0}' must implement the Microsoft.Extensions.Logging.ILogger interface + One of the arguments to the static logging method '{0}' must implement the Microsoft.Extensions.Logging.ILogger interface {Locked="Microsoft.Extensions.Logging.ILogger"} diff --git a/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.tr.xlf b/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.tr.xlf index 5c0c06adebdb83..dccdbd55e57aa9 100644 --- a/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.tr.xlf +++ b/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.tr.xlf @@ -3,8 +3,8 @@ - Argument `{0}` is not referenced from the logging message - Argument `{0}` is not referenced from the logging message + Argument '{0}' is not referenced from the logging message + Argument '{0}' is not referenced from the logging message @@ -73,8 +73,8 @@ - One of the arguments to the static logging method `{0}` must implement the Microsoft.Extensions.Logging.ILogger interface - One of the arguments to the static logging method `{0}` must implement the Microsoft.Extensions.Logging.ILogger interface + One of the arguments to the static logging method '{0}' must implement the Microsoft.Extensions.Logging.ILogger interface + One of the arguments to the static logging method '{0}' must implement the Microsoft.Extensions.Logging.ILogger interface {Locked="Microsoft.Extensions.Logging.ILogger"} diff --git a/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.zh-Hans.xlf b/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.zh-Hans.xlf index 5a18bd8745a28c..98b2d4b7185e9b 100644 --- a/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.zh-Hans.xlf +++ b/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.zh-Hans.xlf @@ -3,8 +3,8 @@ - Argument `{0}` is not referenced from the logging message - Argument `{0}` is not referenced from the logging message + Argument '{0}' is not referenced from the logging message + Argument '{0}' is not referenced from the logging message @@ -73,8 +73,8 @@ - One of the arguments to the static logging method `{0}` must implement the Microsoft.Extensions.Logging.ILogger interface - One of the arguments to the static logging method `{0}` must implement the Microsoft.Extensions.Logging.ILogger interface + One of the arguments to the static logging method '{0}' must implement the Microsoft.Extensions.Logging.ILogger interface + One of the arguments to the static logging method '{0}' must implement the Microsoft.Extensions.Logging.ILogger interface {Locked="Microsoft.Extensions.Logging.ILogger"} diff --git a/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.zh-Hant.xlf b/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.zh-Hant.xlf index 2f532e534f2df7..0a54ae2ca73273 100644 --- a/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.zh-Hant.xlf +++ b/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.zh-Hant.xlf @@ -3,8 +3,8 @@ - Argument `{0}` is not referenced from the logging message - Argument `{0}` is not referenced from the logging message + Argument '{0}' is not referenced from the logging message + Argument '{0}' is not referenced from the logging message @@ -73,8 +73,8 @@ - One of the arguments to the static logging method `{0}` must implement the Microsoft.Extensions.Logging.ILogger interface - One of the arguments to the static logging method `{0}` must implement the Microsoft.Extensions.Logging.ILogger interface + One of the arguments to the static logging method '{0}' must implement the Microsoft.Extensions.Logging.ILogger interface + One of the arguments to the static logging method '{0}' must implement the Microsoft.Extensions.Logging.ILogger interface {Locked="Microsoft.Extensions.Logging.ILogger"} diff --git a/src/libraries/Microsoft.Extensions.Logging.Abstractions/tests/Microsoft.Extensions.Logging.Generators.Tests/LoggerMessageGeneratorParserTests.cs b/src/libraries/Microsoft.Extensions.Logging.Abstractions/tests/Microsoft.Extensions.Logging.Generators.Tests/LoggerMessageGeneratorParserTests.cs index fe0b77239c9681..e3e62f72b10cf7 100644 --- a/src/libraries/Microsoft.Extensions.Logging.Abstractions/tests/Microsoft.Extensions.Logging.Generators.Tests/LoggerMessageGeneratorParserTests.cs +++ b/src/libraries/Microsoft.Extensions.Logging.Abstractions/tests/Microsoft.Extensions.Logging.Generators.Tests/LoggerMessageGeneratorParserTests.cs @@ -77,7 +77,7 @@ partial class C Assert.Single(diagnostics); Assert.Equal(DiagnosticDescriptors.ArgumentHasNoCorrespondingTemplate.Id, diagnostics[0].Id); - Assert.Contains("Argument `foo` is not referenced from the logging message", diagnostics[0].GetMessage(), StringComparison.InvariantCulture); + Assert.Contains("Argument 'foo' is not referenced from the logging message", diagnostics[0].GetMessage(), StringComparison.InvariantCulture); } [Fact] @@ -396,7 +396,7 @@ partial class C Assert.Single(diagnostics); Assert.Equal(DiagnosticDescriptors.MissingLoggerArgument.Id, diagnostics[0].Id); - Assert.Contains("One of the arguments to the static logging method `M1` must implement the Microsoft.Extensions.Logging.ILogger interface", diagnostics[0].GetMessage(), StringComparison.InvariantCulture); + Assert.Contains("One of the arguments to the static logging method 'M1' must implement the Microsoft.Extensions.Logging.ILogger interface", diagnostics[0].GetMessage(), StringComparison.InvariantCulture); } [Fact]