From c3f07be56e02467fba21480a5edc7f10b0a540e8 Mon Sep 17 00:00:00 2001 From: Jeff Layton Date: Fri, 11 Jun 2021 15:56:30 -0400 Subject: [PATCH 1/2] Update test with new expected message (Current) Actual Template [foo, foo] is not provided as argument to the logging method (To be) Expected Template 'foo' is not provided as argument to the logging method --- .../LoggerMessageGeneratorParserTests.cs | 1 + 1 file changed, 1 insertion(+) 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 e3e62f72b10cf7..bb158e9f175396 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 @@ -93,6 +93,7 @@ partial class C Assert.Single(diagnostics); Assert.Equal(DiagnosticDescriptors.TemplateHasNoCorrespondingArgument.Id, diagnostics[0].Id); + Assert.Contains("Template 'foo' is not provided as argument to the logging method", diagnostics[0].GetMessage(), StringComparison.InvariantCulture); } [Fact] From 587e538e39822eaf26d27bcc3b395f97254930ee Mon Sep 17 00:00:00 2001 From: Jeff Layton Date: Fri, 11 Jun 2021 16:01:46 -0400 Subject: [PATCH 2/2] Fix Logging Generator Message Template name was not being passed to the diag method as expected, causing the message to contain a key/value pair instead of template name. Also updated the Strings to add quotes around the template name to make TemplateHasNoCorrespondingArgumentMessage consistent with ArgumentHasNoCorrespondingTemplateMessage. Fixes #54008 --- .../gen/LoggerMessageGenerator.Parser.cs | 2 +- .../gen/Resources/Strings.resx | 2 +- .../gen/Resources/xlf/Strings.cs.xlf | 4 ++-- .../gen/Resources/xlf/Strings.de.xlf | 4 ++-- .../gen/Resources/xlf/Strings.es.xlf | 4 ++-- .../gen/Resources/xlf/Strings.fr.xlf | 4 ++-- .../gen/Resources/xlf/Strings.it.xlf | 4 ++-- .../gen/Resources/xlf/Strings.ja.xlf | 4 ++-- .../gen/Resources/xlf/Strings.ko.xlf | 4 ++-- .../gen/Resources/xlf/Strings.pl.xlf | 4 ++-- .../gen/Resources/xlf/Strings.pt-BR.xlf | 4 ++-- .../gen/Resources/xlf/Strings.ru.xlf | 4 ++-- .../gen/Resources/xlf/Strings.tr.xlf | 4 ++-- .../gen/Resources/xlf/Strings.zh-Hans.xlf | 4 ++-- .../gen/Resources/xlf/Strings.zh-Hant.xlf | 4 ++-- 15 files changed, 28 insertions(+), 28 deletions(-) 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 03c5ad2cf57624..8542778705243a 100644 --- a/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/LoggerMessageGenerator.Parser.cs +++ b/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/LoggerMessageGenerator.Parser.cs @@ -323,7 +323,7 @@ public IReadOnlyList GetLogClasses(IEnumerableArgument is not referenced from the logging message - Template {0} is not provided as argument to the logging method + Template '{0}' is not provided as argument to the logging method Logging template has no corresponding method argument 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 8a6e5be5b381c6..980f5e251131e6 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 @@ -153,8 +153,8 @@ - Template {0} is not provided as argument to the logging method - Template {0} is not provided as argument to the logging method + Template '{0}' is not provided as argument to the logging method + Template '{0}' is not provided as argument to the logging method 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 835dfbbc7fbf1a..3c5bd3fc93f2c0 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 @@ -153,8 +153,8 @@ - Template {0} is not provided as argument to the logging method - Template {0} is not provided as argument to the logging method + Template '{0}' is not provided as argument to the logging method + Template '{0}' is not provided as argument to the logging method 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 0db7b4e17b3667..3678d12aca756e 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 @@ -153,8 +153,8 @@ - Template {0} is not provided as argument to the logging method - Template {0} is not provided as argument to the logging method + Template '{0}' is not provided as argument to the logging method + Template '{0}' is not provided as argument to the logging method 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 757ff655a6b142..aa1939b483c88d 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 @@ -153,8 +153,8 @@ - Template {0} is not provided as argument to the logging method - Template {0} is not provided as argument to the logging method + Template '{0}' is not provided as argument to the logging method + Template '{0}' is not provided as argument to the logging method 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 8717aa30c3c287..cf54d519de2fe1 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 @@ -153,8 +153,8 @@ - Template {0} is not provided as argument to the logging method - Template {0} is not provided as argument to the logging method + Template '{0}' is not provided as argument to the logging method + Template '{0}' is not provided as argument to the logging method 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 9ed2e744c66a4c..70ccaa712abaf3 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 @@ -153,8 +153,8 @@ - Template {0} is not provided as argument to the logging method - Template {0} is not provided as argument to the logging method + Template '{0}' is not provided as argument to the logging method + Template '{0}' is not provided as argument to the logging method 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 5b7bbb9010784c..c7248aa6c69122 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 @@ -153,8 +153,8 @@ - Template {0} is not provided as argument to the logging method - Template {0} is not provided as argument to the logging method + Template '{0}' is not provided as argument to the logging method + Template '{0}' is not provided as argument to the logging method 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 eed366ed41893d..475223561b8fd7 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 @@ -153,8 +153,8 @@ - Template {0} is not provided as argument to the logging method - Template {0} is not provided as argument to the logging method + Template '{0}' is not provided as argument to the logging method + Template '{0}' is not provided as argument to the logging method 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 c33ad19bb8cd91..da1942b23f2ad8 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 @@ -153,8 +153,8 @@ - Template {0} is not provided as argument to the logging method - Template {0} is not provided as argument to the logging method + Template '{0}' is not provided as argument to the logging method + Template '{0}' is not provided as argument to the logging method 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 37548b1750a5cc..ed2de8c1c5dca5 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 @@ -153,8 +153,8 @@ - Template {0} is not provided as argument to the logging method - Template {0} is not provided as argument to the logging method + Template '{0}' is not provided as argument to the logging method + Template '{0}' is not provided as argument to the logging method 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 dccdbd55e57aa9..4b86ee057d8459 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 @@ -153,8 +153,8 @@ - Template {0} is not provided as argument to the logging method - Template {0} is not provided as argument to the logging method + Template '{0}' is not provided as argument to the logging method + Template '{0}' is not provided as argument to the logging method 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 98b2d4b7185e9b..87f8d9b3a58485 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 @@ -153,8 +153,8 @@ - Template {0} is not provided as argument to the logging method - Template {0} is not provided as argument to the logging method + Template '{0}' is not provided as argument to the logging method + Template '{0}' is not provided as argument to the logging method 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 0a54ae2ca73273..a34749c1f2727d 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 @@ -153,8 +153,8 @@ - Template {0} is not provided as argument to the logging method - Template {0} is not provided as argument to the logging method + Template '{0}' is not provided as argument to the logging method + Template '{0}' is not provided as argument to the logging method