diff --git a/.build/TestReferences.Common.targets b/.build/TestReferences.Common.targets
index 4c1ce1907..8940dcd6e 100644
--- a/.build/TestReferences.Common.targets
+++ b/.build/TestReferences.Common.targets
@@ -8,4 +8,30 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ $(PkgJ2N)/lib/net40/J2N.dll
+
+
\ No newline at end of file
diff --git a/.build/dependencies.props b/.build/dependencies.props
index 76203054e..1aa41aff5 100644
--- a/.build/dependencies.props
+++ b/.build/dependencies.props
@@ -1,7 +1,7 @@
1.2.0
- 2.1.0-alpha-0043
+ 2.1.0-alpha-0090
2.0.0
6.0.0
1.1.2
@@ -10,10 +10,14 @@
1.1.1
$(MicrosoftSourceLinkAzureReposGitPackageReferenceVersion)
[3.5.73-alpha]
+ 4.0.0
2.0.3
3.12.0
3.13.0
+ 4.5.1
4.5.5
+ 6.0.0
+ 4.7.1
3.0.0-preview-0027-g2711105671
diff --git a/.build/t4-transform.targets b/.build/t4-transform.targets
index f44db6aee..4f51f57bc 100644
--- a/.build/t4-transform.targets
+++ b/.build/t4-transform.targets
@@ -8,7 +8,7 @@
false
true
- false
+ true
$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TextTemplating\Microsoft.TextTemplating.targets
diff --git a/Directory.Build.props b/Directory.Build.props
index 6816d956a..0ea246c68 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -8,6 +8,10 @@
$(RepositoryRoot)_artifacts
true
+
+
+ false
+
$(RepositoryRoot).build/key.snk
@@ -29,6 +33,8 @@
false
b
icudt
+
+ $(NUGET_PACKAGES)
diff --git a/Directory.Build.targets b/Directory.Build.targets
index b9400a21f..1b644b9f7 100644
--- a/Directory.Build.targets
+++ b/Directory.Build.targets
@@ -42,6 +42,7 @@
$(DefineConstants);FEATURE_ASYNCLOCAL
$(DefineConstants);FEATURE_CULTUREINFO_CURRENTCULTURE_SETTER
$(DefineConstants);FEATURE_RUNTIMEINFORMATION_ISOSPLATFORM
+ $(DefineConstants);FEATURE_STRINGBUILDER_APPEND_CHARPTR
portable
@@ -56,18 +57,23 @@
+
+
+
+ $(DefineConstants);FEATURE_STRINGBUILDER_APPEND_CHARPTR
+
+
+
- $(DefineConstants);FEATURE_ARRAYPOOL
$(DefineConstants);FEATURE_CULTUREINFO_DEFAULTTHREADCURRENTCULTURE
$(DefineConstants);FEATURE_EXCEPTION_HRESULT
$(DefineConstants);FEATURE_IREADONLYCOLLECTIONS
$(DefineConstants);FEATURE_METHODIMPLOPTIONS_AGRESSIVEINLINING
$(DefineConstants);FEATURE_MICROSOFT_EXTENSIONS_CACHING
$(DefineConstants);FEATURE_REGEX_MATCHTIMEOUT
- $(DefineConstants);FEATURE_SPAN
$(DefineConstants);FEATURE_TASK_ASYNC_AWAIT
$(DefineConstants);FEATURE_TASK_RUN
$(DefineConstants);FEATURE_TYPEDWEAKREFERENCE
@@ -141,6 +147,12 @@
full
+
+
+ $(DefineConstants);FEATURE_ARRAYPOOL
+ $(DefineConstants);FEATURE_SPAN
+
+
$(DefineConstants);DEBUG
@@ -204,7 +216,7 @@
-
+
diff --git a/src/ICU4N.TestFramework/Dev/Util/UnicodeMap.cs b/src/ICU4N.TestFramework/Dev/Util/UnicodeMap.cs
index fc931baef..534ed0ab8 100644
--- a/src/ICU4N.TestFramework/Dev/Util/UnicodeMap.cs
+++ b/src/ICU4N.TestFramework/Dev/Util/UnicodeMap.cs
@@ -1636,7 +1636,7 @@ public static IDictionary Freeze(IDictionary targe
{
entry.Freeze();
}
- return target.AsReadOnly();
+ return new J2N.Collections.ObjectModel.ReadOnlyDictionary(target);
}
/**
diff --git a/src/ICU4N.TestFramework/ICU4N.TestFramework.csproj b/src/ICU4N.TestFramework/ICU4N.TestFramework.csproj
index 5a18b5563..c785109ae 100644
--- a/src/ICU4N.TestFramework/ICU4N.TestFramework.csproj
+++ b/src/ICU4N.TestFramework/ICU4N.TestFramework.csproj
@@ -2,7 +2,7 @@
- net6.0;netstandard2.0;net451;net40
+ net7.0;net6.0;netstandard2.0;net451;net40
ICU4N
false
diff --git a/src/ICU4N/Impl/LocaleIDParser.cs b/src/ICU4N/Impl/LocaleIDParser.cs
index fbdcad680..c51f6f78d 100644
--- a/src/ICU4N/Impl/LocaleIDParser.cs
+++ b/src/ICU4N/Impl/LocaleIDParser.cs
@@ -109,11 +109,15 @@ public LocaleIDParser(string localeID, bool canonicalize)
#if FEATURE_SPAN
#if !FEATURE_STRING_IMPLCIT_TO_READONLYSPAN
+#if FEATURE_METHODIMPLOPTIONS_AGRESSIVEINLINING
[MethodImpl(MethodImplOptions.AggressiveInlining)]
+#endif
public void Reset(string localeID)
=> Reset(localeID.AsSpan());
+#if FEATURE_METHODIMPLOPTIONS_AGRESSIVEINLINING
[MethodImpl(MethodImplOptions.AggressiveInlining)]
+#endif
public void Reset(string localeID, bool canonicalize)
=> Reset(localeID.AsSpan(), canonicalize);
#endif
@@ -198,7 +202,9 @@ private ReadOnlySpan AsSpan(int start)
#if FEATURE_SPAN
#if !FEATURE_STRING_IMPLCIT_TO_READONLYSPAN
+#if FEATURE_METHODIMPLOPTIONS_AGRESSIVEINLINING
[MethodImpl(MethodImplOptions.AggressiveInlining)]
+#endif
private void Set(int pos, string s)
=> Set(pos, s.AsSpan());
#endif
diff --git a/src/ICU4N/Impl/LocaleIDs.cs b/src/ICU4N/Impl/LocaleIDs.cs
index e6b411edd..ced04560a 100644
--- a/src/ICU4N/Impl/LocaleIDs.cs
+++ b/src/ICU4N/Impl/LocaleIDs.cs
@@ -46,7 +46,9 @@ public static string[] GetISOLanguages()
/// Throws if the
/// three-letter country abbreviation is not available for this locale.
/// ICU 3.0
+#if FEATURE_METHODIMPLOPTIONS_AGRESSIVEINLINING
[MethodImpl(MethodImplOptions.AggressiveInlining)]
+#endif
public static string GetThreeLetterISOCountryName(string country)
=> GetThreeLetterISOCountryName(country.AsSpan());
#endif
@@ -95,7 +97,9 @@ string country
/// Throws if the
/// three-letter language abbreviation is not available for this locale.
/// ICU 3.0
+#if FEATURE_METHODIMPLOPTIONS_AGRESSIVEINLINING
[MethodImpl(MethodImplOptions.AggressiveInlining)]
+#endif
public static string GetThreeLetterISOLanguageName(string language)
=> GetThreeLetterISOLanguageName(language.AsSpan());
#endif
@@ -136,7 +140,9 @@ string language
}
#if FEATURE_SPAN && !FEATURE_STRING_IMPLCIT_TO_READONLYSPAN
+#if FEATURE_METHODIMPLOPTIONS_AGRESSIVEINLINING
[MethodImpl(MethodImplOptions.AggressiveInlining)]
+#endif
public static string ThreeToTwoLetterLanguage(string lang)
=> ThreeToTwoLetterLanguage(lang.AsSpan());
#endif
@@ -166,7 +172,9 @@ string lang
}
#if FEATURE_SPAN && !FEATURE_STRING_IMPLCIT_TO_READONLYSPAN
+#if FEATURE_METHODIMPLOPTIONS_AGRESSIVEINLINING
[MethodImpl(MethodImplOptions.AggressiveInlining)]
+#endif
public static string ThreeToTwoLetterRegion(string region)
=> ThreeToTwoLetterRegion(region.AsSpan());
#endif
@@ -541,7 +549,9 @@ updated to include 1999/12/03 revisions *CWB*/
};
#if FEATURE_SPAN && !FEATURE_STRING_IMPLCIT_TO_READONLYSPAN
+#if FEATURE_METHODIMPLOPTIONS_AGRESSIVEINLINING
[MethodImpl(MethodImplOptions.AggressiveInlining)]
+#endif
public static string GetCurrentCountryID(string oldID)
=> GetCurrentCountryID(oldID.AsSpan());
#endif
@@ -563,7 +573,9 @@ string oldID
}
#if FEATURE_SPAN && !FEATURE_STRING_IMPLCIT_TO_READONLYSPAN
+#if FEATURE_METHODIMPLOPTIONS_AGRESSIVEINLINING
[MethodImpl(MethodImplOptions.AggressiveInlining)]
+#endif
public static string GetCurrentLanguageID(string oldID)
=> GetCurrentLanguageID(oldID.AsSpan());
#endif
diff --git a/src/ICU4N/Impl/Utility.cs b/src/ICU4N/Impl/Utility.cs
index bbe1d1924..13c9fb344 100644
--- a/src/ICU4N/Impl/Utility.cs
+++ b/src/ICU4N/Impl/Utility.cs
@@ -756,7 +756,9 @@ public static string Escape(string s)
/// be updated to point after the escape sequence.
/// Character value from 0 to 10FFFF, or -1 on error.
// ICU4N: To fix lack of implicit conversion
+#if FEATURE_METHODIMPLOPTIONS_AGRESSIVEINLINING
[MethodImpl(MethodImplOptions.AggressiveInlining)]
+#endif
public static int UnescapeAt(string s, ref int offset16)
=> UnescapeAt(s.AsSpan(), ref offset16);
#endif
@@ -1074,7 +1076,9 @@ public static int UnescapeAt(char[] s, ref int offset16) // ICU4N: Changed array
///
/// If an invalid escape is seen.
// ICU4N: To fix lack of implicit conversion
+#if FEATURE_METHODIMPLOPTIONS_AGRESSIVEINLINING
[MethodImpl(MethodImplOptions.AggressiveInlining)]
+#endif
public static string Unescape(string s)
=> Unescape(s.AsSpan());
#endif
@@ -1130,7 +1134,9 @@ public static string Unescape(string s)
/// Convert all escapes in a given string using .
/// Leave invalid escape sequences unchanged.
///
+#if FEATURE_METHODIMPLOPTIONS_AGRESSIVEINLINING
[MethodImpl(MethodImplOptions.AggressiveInlining)]
+#endif
public static string UnescapeLeniently(string s)
=> UnescapeLeniently(s.AsSpan());
#endif
diff --git a/src/ICU4N/Support/MemoryExtensions.cs b/src/ICU4N/Support/MemoryExtensions.cs
index 035750494..095fa7406 100644
--- a/src/ICU4N/Support/MemoryExtensions.cs
+++ b/src/ICU4N/Support/MemoryExtensions.cs
@@ -117,7 +117,9 @@ public static bool StartsWith(this ReadOnlySpan span, string value, String
///
/// Determines whether the specified sequence appears at the start of the span.
///
+#if FEATURE_METHODIMPLOPTIONS_AGRESSIVEINLINING
[MethodImpl(MethodImplOptions.AggressiveInlining)]
+#endif
public unsafe static bool StartsWith(this ReadOnlySpan span, string value) where T : IEquatable
{
int valueLength = value.Length;
@@ -170,7 +172,9 @@ public static bool EndsWith(this ReadOnlySpan span, string value, StringCo
///
/// Determines whether the specified sequence appears at the end of the span.
///
+#if FEATURE_METHODIMPLOPTIONS_AGRESSIVEINLINING
[MethodImpl(MethodImplOptions.AggressiveInlining)]
+#endif
public unsafe static bool EndsWith(this ReadOnlySpan span, string value) where T : IEquatable
{
int spanLength = span.Length;
@@ -260,7 +264,9 @@ public static bool Equals(this ReadOnlySpan span, ReadOnlySpan other
}
}
+#if FEATURE_METHODIMPLOPTIONS_AGRESSIVEINLINING
[MethodImpl(MethodImplOptions.AggressiveInlining)]
+#endif
internal static bool EqualsOrdinal(this ReadOnlySpan span, ReadOnlySpan value)
{
if (span.Length != value.Length)
diff --git a/src/ICU4N/Support/Text/StringExtensions.cs b/src/ICU4N/Support/Text/StringExtensions.cs
index 1aff746fe..0821bc366 100644
--- a/src/ICU4N/Support/Text/StringExtensions.cs
+++ b/src/ICU4N/Support/Text/StringExtensions.cs
@@ -15,7 +15,9 @@ public static int CompareToOrdinalIgnoreCase(this string str, string value)
/// This string.
/// The span into which to copy this string's contents.
/// If is too short.
+#if FEATURE_METHODIMPLOPTIONS_AGRESSIVEINLINING
[MethodImpl(MethodImplOptions.AggressiveInlining)]
+#endif
public static void CopyTo(this string s, Span destination) // ICU4N TODO: Move to J2N?
{
if (s is null)
@@ -35,7 +37,9 @@ public static void CopyTo(this string s, Span destination) // ICU4N TODO:
/// This string.
/// The span into which to copy this string's contents.
/// true if the data was copied; false if the destination was too short to fit the contents of the string.
+#if FEATURE_METHODIMPLOPTIONS_AGRESSIVEINLINING
[MethodImpl(MethodImplOptions.AggressiveInlining)]
+#endif
public static bool TryCopyTo(this string s, Span destination) // ICU4N TODO: Move to J2N?
{
if (s is null)
diff --git a/src/ICU4N/Support/Text/ValueStringBuilder.IcuNumber.Formatting.cs b/src/ICU4N/Support/Text/ValueStringBuilder.IcuNumber.Formatting.cs
index 51da1304f..97386e317 100644
--- a/src/ICU4N/Support/Text/ValueStringBuilder.IcuNumber.Formatting.cs
+++ b/src/ICU4N/Support/Text/ValueStringBuilder.IcuNumber.Formatting.cs
@@ -13,7 +13,9 @@ internal ref partial struct ValueStringBuilder
private const int CharStackBufferSize = 32;
#if !FEATURE_STRING_IMPLCIT_TO_READONLYSPAN
+#if FEATURE_METHODIMPLOPTIONS_AGRESSIVEINLINING
[MethodImpl(MethodImplOptions.AggressiveInlining)]
+#endif
internal void AppendFormat(long value, string? format, UNumberFormatInfo info, int[]? numberGroupSizesOverride = null)
=> AppendFormat(value, format.AsSpan(), info, numberGroupSizesOverride);
#endif
@@ -47,7 +49,9 @@ internal void AppendFormat(long value, ReadOnlySpan format, UNumberFormatI
#if !FEATURE_STRING_IMPLCIT_TO_READONLYSPAN
+#if FEATURE_METHODIMPLOPTIONS_AGRESSIVEINLINING
[MethodImpl(MethodImplOptions.AggressiveInlining)]
+#endif
internal void AppendFormat(double value, string? format, UNumberFormatInfo info, int[]? numberGroupSizesOverride = null)
=> AppendFormat(value, format.AsSpan(), info, numberGroupSizesOverride);
#endif
@@ -80,7 +84,9 @@ internal void AppendFormat(double value, ReadOnlySpan format, UNumberForma
}
#if !FEATURE_STRING_IMPLCIT_TO_READONLYSPAN
+#if FEATURE_METHODIMPLOPTIONS_AGRESSIVEINLINING
[MethodImpl(MethodImplOptions.AggressiveInlining)]
+#endif
internal void InsertFormat(int index, long value, string? format, UNumberFormatInfo info, int[]? numberGroupSizesOverride = null)
=> InsertFormat(index, value, format.AsSpan(), info, numberGroupSizesOverride);
#endif
@@ -108,7 +114,9 @@ internal void InsertFormat(int index, long value, ReadOnlySpan format, UNu
}
#if !FEATURE_STRING_IMPLCIT_TO_READONLYSPAN
+#if FEATURE_METHODIMPLOPTIONS_AGRESSIVEINLINING
[MethodImpl(MethodImplOptions.AggressiveInlining)]
+#endif
internal void InsertFormat(int index, double value, string? format, UNumberFormatInfo info, int[]? numberGroupSizesOverride = null)
=> InsertFormat(index, value, format.AsSpan(), info, numberGroupSizesOverride);
#endif
diff --git a/src/ICU4N/Support/Text/ValueStringBuilder.cs b/src/ICU4N/Support/Text/ValueStringBuilder.cs
index e8ed0106c..d500caaf3 100644
--- a/src/ICU4N/Support/Text/ValueStringBuilder.cs
+++ b/src/ICU4N/Support/Text/ValueStringBuilder.cs
@@ -208,7 +208,9 @@ public void Insert(int index, ReadOnlySpan s)
_pos += count;
}
+#if FEATURE_METHODIMPLOPTIONS_AGRESSIVEINLINING
[MethodImpl(MethodImplOptions.AggressiveInlining)]
+#endif
public void Append(char c)
{
int pos = _pos;
@@ -223,7 +225,9 @@ public void Append(char c)
}
}
+#if FEATURE_METHODIMPLOPTIONS_AGRESSIVEINLINING
[MethodImpl(MethodImplOptions.AggressiveInlining)]
+#endif
public void Append(string? s)
{
if (s == null)
@@ -302,7 +306,9 @@ public void Append(ReadOnlySpan value)
_pos += value.Length;
}
+#if FEATURE_METHODIMPLOPTIONS_AGRESSIVEINLINING
[MethodImpl(MethodImplOptions.AggressiveInlining)]
+#endif
public Span AppendSpan(int length)
{
int origPos = _pos;
@@ -388,7 +394,9 @@ private void Grow(int additionalCapacityBeyondPos)
}
}
+#if FEATURE_METHODIMPLOPTIONS_AGRESSIVEINLINING
[MethodImpl(MethodImplOptions.AggressiveInlining)]
+#endif
public void Dispose()
{
char[]? toReturn = _arrayToReturnToPool;
diff --git a/src/ICU4N/Text/PluralRules.cs b/src/ICU4N/Text/PluralRules.cs
index c9cda13f2..34b025857 100644
--- a/src/ICU4N/Text/PluralRules.cs
+++ b/src/ICU4N/Text/PluralRules.cs
@@ -2296,7 +2296,9 @@ private static ParseRuleStatus TryParseRule(ReadOnlySpan description, out
}
#if !FEATURE_STRING_IMPLCIT_TO_READONLYSPAN
+#if FEATURE_METHODIMPLOPTIONS_AGRESSIVEINLINING
[MethodImpl(MethodImplOptions.AggressiveInlining)]
+#endif
internal static bool TryParseRule(string keyword, string description, out Rule result)
=> TryParseRule(keyword.AsSpan(), description.AsSpan(), out result);
#endif
diff --git a/tests/ICU4N.Tests/ICU4N.Tests.csproj b/tests/ICU4N.Tests/ICU4N.Tests.csproj
index 709b9b32d..7e3e8c795 100644
--- a/tests/ICU4N.Tests/ICU4N.Tests.csproj
+++ b/tests/ICU4N.Tests/ICU4N.Tests.csproj
@@ -9,7 +9,9 @@
True
- false
+
+
+ true
diff --git a/tests/ICU4N.Tests/Support/Text/ValueStringBuilderTest.cs b/tests/ICU4N.Tests/Support/Text/ValueStringBuilderTest.cs
index 78b34494d..d1499a54e 100644
--- a/tests/ICU4N.Tests/Support/Text/ValueStringBuilderTest.cs
+++ b/tests/ICU4N.Tests/Support/Text/ValueStringBuilderTest.cs
@@ -105,6 +105,7 @@ public void Append_CharInt_MatchesStringBuilder()
Assert.AreEqual(sb.ToString(), vsb.ToString());
}
+#if FEATURE_STRINGBUILDER_APPEND_CHARPTR
[Test]
public unsafe void Append_PtrInt_MatchesStringBuilder()
{
@@ -123,6 +124,7 @@ public unsafe void Append_PtrInt_MatchesStringBuilder()
Assert.AreEqual(sb.Length, vsb.Length);
Assert.AreEqual(sb.ToString(), vsb.ToString());
}
+#endif
[Test]
public void AppendSpan_DataAppendedCorrectly()