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()});");