Skip to content

Commit 1fb8c50

Browse files
committed
Added internal notes with link to the WinUI issue
1 parent 76787ed commit 1fb8c50

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

Microsoft.Toolkit/Extensions/StringExtensions.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,16 @@ public static string FixHtml(this string html)
147147
/// <param name="args">The object which will receive the linked String.</param>
148148
/// <returns>Truncated string.</returns>
149149
[Obsolete("This method will be removed in a future version of the Toolkit. Use the native C# string interpolation syntax instead, see: https://docs.microsoft.com/dotnet/csharp/language-reference/tokens/interpolated")]
150-
public static string AsFormat(this string format, params object[] args) => string.Format(format, args);
150+
public static string AsFormat(this string format, params object[] args)
151+
{
152+
// Note: this extension was originally added to help developers using {x:Bind} in XAML, but
153+
// due to a known limitation in the UWP/WinUI XAML compiler, using either this method or the
154+
// standard string.Format method from the BCL directly doesn't always work. Since this method
155+
// doesn't actually provide any benefit over the built-in one, it has been marked as obsolete.
156+
// For more details, see the WinUI issue on the XAML compiler limitation here:
157+
// https://github.com/microsoft/microsoft-ui-xaml/issues/2654.
158+
return string.Format(format, args);
159+
}
151160

152161
/// <summary>
153162
/// Truncates a string to the specified length.

0 commit comments

Comments
 (0)