From 16b25a0d2622e5b60ecd52c4317cce753a38e43d Mon Sep 17 00:00:00 2001 From: aw Date: Sun, 19 Jan 2025 01:54:21 +0100 Subject: [PATCH 1/2] Fixes dotnet/roslyn-analyzers#7536 --- .../Resources.Designer.cs | 2 +- .../Resources.Designer.cs | 6 +++--- .../Resources.Designer.cs | 2 +- .../Resources.Designer.cs | 6 +++--- .../Resources.Designer.cs | 2 +- .../Resources.Designer.cs | 6 +++--- .../ResxGeneratorTests.cs | 2 +- .../AbstractResxGenerator.cs | 6 +++--- 8 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/Microsoft.CodeAnalysis.ResxSourceGenerator/Microsoft.CodeAnalysis.ResxSourceGenerator.UnitTests/Resources/SingleString_EmitFormatMethodsCSharpAsync_0_False/Resources.Designer.cs b/src/Microsoft.CodeAnalysis.ResxSourceGenerator/Microsoft.CodeAnalysis.ResxSourceGenerator.UnitTests/Resources/SingleString_EmitFormatMethodsCSharpAsync_0_False/Resources.Designer.cs index 5d380b3db1..af2d0a7ffb 100644 --- a/src/Microsoft.CodeAnalysis.ResxSourceGenerator/Microsoft.CodeAnalysis.ResxSourceGenerator.UnitTests/Resources/SingleString_EmitFormatMethodsCSharpAsync_0_False/Resources.Designer.cs +++ b/src/Microsoft.CodeAnalysis.ResxSourceGenerator/Microsoft.CodeAnalysis.ResxSourceGenerator.UnitTests/Resources/SingleString_EmitFormatMethodsCSharpAsync_0_False/Resources.Designer.cs @@ -15,7 +15,7 @@ internal static partial class Resources [return: global::System.Diagnostics.CodeAnalysis.NotNullIfNotNull("defaultValue")] internal static string? GetResourceString(string resourceKey, string? defaultValue = null) => ResourceManager.GetString(resourceKey, Culture) ?? defaultValue; /// value {0} - public static string @Name => GetResourceString("Name")!; + public static string @Name_with_dots => GetResourceString("Name.with.dots")!; } } diff --git a/src/Microsoft.CodeAnalysis.ResxSourceGenerator/Microsoft.CodeAnalysis.ResxSourceGenerator.UnitTests/Resources/SingleString_EmitFormatMethodsCSharpAsync_0_True/Resources.Designer.cs b/src/Microsoft.CodeAnalysis.ResxSourceGenerator/Microsoft.CodeAnalysis.ResxSourceGenerator.UnitTests/Resources/SingleString_EmitFormatMethodsCSharpAsync_0_True/Resources.Designer.cs index b3919a15c4..f8079e4d9d 100644 --- a/src/Microsoft.CodeAnalysis.ResxSourceGenerator/Microsoft.CodeAnalysis.ResxSourceGenerator.UnitTests/Resources/SingleString_EmitFormatMethodsCSharpAsync_0_True/Resources.Designer.cs +++ b/src/Microsoft.CodeAnalysis.ResxSourceGenerator/Microsoft.CodeAnalysis.ResxSourceGenerator.UnitTests/Resources/SingleString_EmitFormatMethodsCSharpAsync_0_True/Resources.Designer.cs @@ -29,10 +29,10 @@ private static string GetResourceString(string resourceKey, string[]? formatterN } /// value {0} - public static string @Name => GetResourceString("Name")!; + public static string @Name_with_dots => GetResourceString("Name.with.dots")!; /// value {0} - internal static string FormatName(object? p0) - => string.Format(Culture, GetResourceString("Name") ?? "", p0); + internal static string FormatName_with_dots(object? p0) + => string.Format(Culture, GetResourceString("Name.with.dots") ?? "", p0); } diff --git a/src/Microsoft.CodeAnalysis.ResxSourceGenerator/Microsoft.CodeAnalysis.ResxSourceGenerator.UnitTests/Resources/SingleString_EmitFormatMethodsCSharpAsync_replacement_False/Resources.Designer.cs b/src/Microsoft.CodeAnalysis.ResxSourceGenerator/Microsoft.CodeAnalysis.ResxSourceGenerator.UnitTests/Resources/SingleString_EmitFormatMethodsCSharpAsync_replacement_False/Resources.Designer.cs index 4feef75d44..a66e2c1098 100644 --- a/src/Microsoft.CodeAnalysis.ResxSourceGenerator/Microsoft.CodeAnalysis.ResxSourceGenerator.UnitTests/Resources/SingleString_EmitFormatMethodsCSharpAsync_replacement_False/Resources.Designer.cs +++ b/src/Microsoft.CodeAnalysis.ResxSourceGenerator/Microsoft.CodeAnalysis.ResxSourceGenerator.UnitTests/Resources/SingleString_EmitFormatMethodsCSharpAsync_replacement_False/Resources.Designer.cs @@ -15,7 +15,7 @@ internal static partial class Resources [return: global::System.Diagnostics.CodeAnalysis.NotNullIfNotNull("defaultValue")] internal static string? GetResourceString(string resourceKey, string? defaultValue = null) => ResourceManager.GetString(resourceKey, Culture) ?? defaultValue; /// value {replacement} - public static string @Name => GetResourceString("Name")!; + public static string @Name_with_dots => GetResourceString("Name.with.dots")!; } } diff --git a/src/Microsoft.CodeAnalysis.ResxSourceGenerator/Microsoft.CodeAnalysis.ResxSourceGenerator.UnitTests/Resources/SingleString_EmitFormatMethodsCSharpAsync_replacement_True/Resources.Designer.cs b/src/Microsoft.CodeAnalysis.ResxSourceGenerator/Microsoft.CodeAnalysis.ResxSourceGenerator.UnitTests/Resources/SingleString_EmitFormatMethodsCSharpAsync_replacement_True/Resources.Designer.cs index fa77240ec6..0d1f9aabc4 100644 --- a/src/Microsoft.CodeAnalysis.ResxSourceGenerator/Microsoft.CodeAnalysis.ResxSourceGenerator.UnitTests/Resources/SingleString_EmitFormatMethodsCSharpAsync_replacement_True/Resources.Designer.cs +++ b/src/Microsoft.CodeAnalysis.ResxSourceGenerator/Microsoft.CodeAnalysis.ResxSourceGenerator.UnitTests/Resources/SingleString_EmitFormatMethodsCSharpAsync_replacement_True/Resources.Designer.cs @@ -29,10 +29,10 @@ private static string GetResourceString(string resourceKey, string[]? formatterN } /// value {replacement} - public static string @Name => GetResourceString("Name")!; + public static string @Name_with_dots => GetResourceString("Name.with.dots")!; /// value {replacement} - internal static string FormatName(object? replacement) - => string.Format(Culture, GetResourceString("Name", new[] { "replacement" }), replacement); + internal static string FormatName_with_dots(object? replacement) + => string.Format(Culture, GetResourceString("Name.with.dots", new[] { "replacement" }), replacement); } diff --git a/src/Microsoft.CodeAnalysis.ResxSourceGenerator/Microsoft.CodeAnalysis.ResxSourceGenerator.UnitTests/Resources/SingleString_EmitFormatMethodsCSharpAsync_x_False/Resources.Designer.cs b/src/Microsoft.CodeAnalysis.ResxSourceGenerator/Microsoft.CodeAnalysis.ResxSourceGenerator.UnitTests/Resources/SingleString_EmitFormatMethodsCSharpAsync_x_False/Resources.Designer.cs index 19b20ba811..db176ffb31 100644 --- a/src/Microsoft.CodeAnalysis.ResxSourceGenerator/Microsoft.CodeAnalysis.ResxSourceGenerator.UnitTests/Resources/SingleString_EmitFormatMethodsCSharpAsync_x_False/Resources.Designer.cs +++ b/src/Microsoft.CodeAnalysis.ResxSourceGenerator/Microsoft.CodeAnalysis.ResxSourceGenerator.UnitTests/Resources/SingleString_EmitFormatMethodsCSharpAsync_x_False/Resources.Designer.cs @@ -15,7 +15,7 @@ internal static partial class Resources [return: global::System.Diagnostics.CodeAnalysis.NotNullIfNotNull("defaultValue")] internal static string? GetResourceString(string resourceKey, string? defaultValue = null) => ResourceManager.GetString(resourceKey, Culture) ?? defaultValue; /// value {x} - public static string @Name => GetResourceString("Name")!; + public static string @Name_with_dots => GetResourceString("Name.with.dots")!; } } diff --git a/src/Microsoft.CodeAnalysis.ResxSourceGenerator/Microsoft.CodeAnalysis.ResxSourceGenerator.UnitTests/Resources/SingleString_EmitFormatMethodsCSharpAsync_x_True/Resources.Designer.cs b/src/Microsoft.CodeAnalysis.ResxSourceGenerator/Microsoft.CodeAnalysis.ResxSourceGenerator.UnitTests/Resources/SingleString_EmitFormatMethodsCSharpAsync_x_True/Resources.Designer.cs index fe057e9cbf..319ce3d651 100644 --- a/src/Microsoft.CodeAnalysis.ResxSourceGenerator/Microsoft.CodeAnalysis.ResxSourceGenerator.UnitTests/Resources/SingleString_EmitFormatMethodsCSharpAsync_x_True/Resources.Designer.cs +++ b/src/Microsoft.CodeAnalysis.ResxSourceGenerator/Microsoft.CodeAnalysis.ResxSourceGenerator.UnitTests/Resources/SingleString_EmitFormatMethodsCSharpAsync_x_True/Resources.Designer.cs @@ -29,10 +29,10 @@ private static string GetResourceString(string resourceKey, string[]? formatterN } /// value {x} - public static string @Name => GetResourceString("Name")!; + public static string @Name_with_dots => GetResourceString("Name.with.dots")!; /// value {x} - internal static string FormatName(object? x) - => string.Format(Culture, GetResourceString("Name", new[] { "x" }), x); + internal static string FormatName_with_dots(object? x) + => string.Format(Culture, GetResourceString("Name.with.dots", new[] { "x" }), x); } diff --git a/src/Microsoft.CodeAnalysis.ResxSourceGenerator/Microsoft.CodeAnalysis.ResxSourceGenerator.UnitTests/ResxGeneratorTests.cs b/src/Microsoft.CodeAnalysis.ResxSourceGenerator/Microsoft.CodeAnalysis.ResxSourceGenerator.UnitTests/ResxGeneratorTests.cs index fb34292a8a..fe3dbe0772 100644 --- a/src/Microsoft.CodeAnalysis.ResxSourceGenerator/Microsoft.CodeAnalysis.ResxSourceGenerator.UnitTests/ResxGeneratorTests.cs +++ b/src/Microsoft.CodeAnalysis.ResxSourceGenerator/Microsoft.CodeAnalysis.ResxSourceGenerator.UnitTests/ResxGeneratorTests.cs @@ -630,7 +630,7 @@ public async Task SingleString_EmitFormatMethodsCSharpAsync( bool emitFormatMethods) { var code = ResxHeader - + $@" + + $@" value {{{placeholder}}} comment " diff --git a/src/Microsoft.CodeAnalysis.ResxSourceGenerator/Microsoft.CodeAnalysis.ResxSourceGenerator/AbstractResxGenerator.cs b/src/Microsoft.CodeAnalysis.ResxSourceGenerator/Microsoft.CodeAnalysis.ResxSourceGenerator/AbstractResxGenerator.cs index 5dfad74e15..e8dfa1eaca 100644 --- a/src/Microsoft.CodeAnalysis.ResxSourceGenerator/Microsoft.CodeAnalysis.ResxSourceGenerator/AbstractResxGenerator.cs +++ b/src/Microsoft.CodeAnalysis.ResxSourceGenerator/Microsoft.CodeAnalysis.ResxSourceGenerator/AbstractResxGenerator.cs @@ -450,7 +450,7 @@ public bool Execute(CancellationToken cancellationToken) if (resourceString.HasArguments) { RenderDocComment(language, memberIndent, strings, docCommentString); - RenderFormatMethod(memberIndent, language, CompilationInformation.SupportsNullable, strings, resourceString); + RenderFormatMethod(memberIndent, language, CompilationInformation.SupportsNullable, strings, resourceString, identifier); } } @@ -811,9 +811,9 @@ private static void SplitName(string fullName, out string? namespaceName, out st } } - private static void RenderFormatMethod(string indent, Lang language, bool supportsNullable, StringBuilder strings, ResourceString resourceString) + private static void RenderFormatMethod(string indent, Lang language, bool supportsNullable, StringBuilder strings, ResourceString resourceString, string identifier) { - strings.AppendLine($"{indent}internal static string Format{resourceString.Name}({resourceString.GetMethodParameters(language, supportsNullable)})"); + strings.AppendLine($"{indent}internal static string Format{identifier}({resourceString.GetMethodParameters(language, supportsNullable)})"); if (resourceString.UsingNamedArgs) { strings.AppendLine($@"{indent} => string.Format(Culture, GetResourceString(""{resourceString.Name}"", new[] {{ {resourceString.GetArgumentNames()} }}), {resourceString.GetArguments()});"); From 18872051122fdc4d410a0c34780e8780eeb088f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20W=C5=82oszczy=C5=84ski?= Date: Sun, 19 Jan 2025 04:01:23 +0100 Subject: [PATCH 2/2] Changes after msbuild /t:pack --- src/NetAnalyzers/RulesMissingDocumentation.md | 1 - 1 file changed, 1 deletion(-) diff --git a/src/NetAnalyzers/RulesMissingDocumentation.md b/src/NetAnalyzers/RulesMissingDocumentation.md index b59a35228c..0bc98f5fe7 100644 --- a/src/NetAnalyzers/RulesMissingDocumentation.md +++ b/src/NetAnalyzers/RulesMissingDocumentation.md @@ -3,4 +3,3 @@ Rule ID | Missing Help Link | Title | --------|-------------------|-------| CA2023 | | Invalid braces in message template | -CA2024 | | Do not use 'StreamReader.EndOfStream' in async methods |