Skip to content

Commit fd26be1

Browse files
authored
Merge branch 'release/7.0-staging' into merge/release/7.0-to-release/7.0-staging
2 parents 4b8bbf5 + b075459 commit fd26be1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+940
-630
lines changed

.config/dotnet-tools.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
]
1616
},
1717
"microsoft.dotnet.xharness.cli": {
18-
"version": "7.0.0-prerelease.23309.1",
18+
"version": "7.0.0-prerelease.23321.1",
1919
"commands": [
2020
"xharness"
2121
]

NuGet.config

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
<!--Begin: Package sources managed by Dependency Flow automation. Do not edit the sources below.-->
1111
<!-- Begin: Package sources from dotnet-emsdk -->
1212
<add key="darc-pub-dotnet-emsdk-fcd8602" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/darc-pub-dotnet-emsdk-fcd86021/nuget/v3/index.json" />
13+
<add key="darc-pub-dotnet-emsdk-9b227c1" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/darc-pub-dotnet-emsdk-9b227c16/nuget/v3/index.json" />
14+
<add key="darc-pub-dotnet-emsdk-9b227c1-2" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/darc-pub-dotnet-emsdk-9b227c16-2/nuget/v3/index.json" />
15+
<add key="darc-pub-dotnet-emsdk-9b227c1-1" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/darc-pub-dotnet-emsdk-9b227c16-1/nuget/v3/index.json" />
16+
<add key="darc-pub-dotnet-emsdk-96ba1fe" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/darc-pub-dotnet-emsdk-96ba1fed/nuget/v3/index.json" />
1317
<!-- End: Package sources from dotnet-emsdk -->
1418
<!--End: Package sources managed by Dependency Flow automation. Do not edit the sources above.-->
1519
<!--

THIRD-PARTY-NOTICES.TXT

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ https://github.com/madler/zlib
7373
https://zlib.net/zlib_license.html
7474

7575
/* zlib.h -- interface of the 'zlib' general purpose compression library
76-
version 1.2.12, March 27th, 2022
76+
version 1.2.13, October 13th, 2022
7777

7878
Copyright (C) 1995-2022 Jean-loup Gailly and Mark Adler
7979

eng/Version.Details.xml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<Dependencies>
22
<ProductDependencies>
3-
<Dependency Name="Microsoft.NETCore.Runtime.ICU.Transport" Version="7.0.0-rtm.23315.2">
3+
<Dependency Name="Microsoft.NETCore.Runtime.ICU.Transport" Version="7.0.0-rtm.23362.1">
44
<Uri>https://github.com/dotnet/icu</Uri>
5-
<Sha>a7de1bebfa53d0f958e588633664ce008b78adf2</Sha>
5+
<Sha>5e41bd879a83393b0cc3934576a12994ba9a7132</Sha>
66
</Dependency>
77
<Dependency Name="System.Net.MsQuic.Transport" Version="7.0.0-alpha.1.22459.1">
88
<Uri>https://github.com/dotnet/msquic</Uri>
@@ -242,21 +242,21 @@
242242
<Uri>https://github.com/dotnet/runtime</Uri>
243243
<Sha>e680411c22e33f45821f4ae64365a2970b2430a6</Sha>
244244
</Dependency>
245-
<Dependency Name="Microsoft.NET.ILLink.Tasks" Version="7.0.100-1.23321.1">
245+
<Dependency Name="Microsoft.NET.ILLink.Tasks" Version="7.0.100-1.23401.1">
246246
<Uri>https://github.com/dotnet/linker</Uri>
247-
<Sha>13a94b5bdc9d01ecd9eb2bd699bd34d597c3ec19</Sha>
247+
<Sha>53b3303c57b3fe659500fb362a0eef12991c1197</Sha>
248248
</Dependency>
249-
<Dependency Name="Microsoft.DotNet.XHarness.TestRunners.Common" Version="7.0.0-prerelease.23309.1">
249+
<Dependency Name="Microsoft.DotNet.XHarness.TestRunners.Common" Version="7.0.0-prerelease.23321.1">
250250
<Uri>https://github.com/dotnet/xharness</Uri>
251-
<Sha>0627fd5c5d3d1979e3a2234280e47c149c73333a</Sha>
251+
<Sha>08db853202902978dedf7562643a5b29bebf8645</Sha>
252252
</Dependency>
253-
<Dependency Name="Microsoft.DotNet.XHarness.TestRunners.Xunit" Version="7.0.0-prerelease.23309.1">
253+
<Dependency Name="Microsoft.DotNet.XHarness.TestRunners.Xunit" Version="7.0.0-prerelease.23321.1">
254254
<Uri>https://github.com/dotnet/xharness</Uri>
255-
<Sha>0627fd5c5d3d1979e3a2234280e47c149c73333a</Sha>
255+
<Sha>08db853202902978dedf7562643a5b29bebf8645</Sha>
256256
</Dependency>
257-
<Dependency Name="Microsoft.DotNet.XHarness.CLI" Version="7.0.0-prerelease.23309.1">
257+
<Dependency Name="Microsoft.DotNet.XHarness.CLI" Version="7.0.0-prerelease.23321.1">
258258
<Uri>https://github.com/dotnet/xharness</Uri>
259-
<Sha>0627fd5c5d3d1979e3a2234280e47c149c73333a</Sha>
259+
<Sha>08db853202902978dedf7562643a5b29bebf8645</Sha>
260260
</Dependency>
261261
<Dependency Name="Microsoft.DotNet.PackageTesting" Version="7.0.0-beta.23361.2">
262262
<Uri>https://github.com/dotnet/arcade</Uri>
@@ -278,9 +278,9 @@
278278
<Uri>https://dev.azure.com/dnceng/internal/_git/dotnet-optimization</Uri>
279279
<Sha>5e0b0da43f660de5798186f4fd3bc900fc90576c</Sha>
280280
</Dependency>
281-
<Dependency Name="Microsoft.DotNet.HotReload.Utils.Generator.BuildTool" Version="7.0.0-alpha.0.23316.2">
281+
<Dependency Name="Microsoft.DotNet.HotReload.Utils.Generator.BuildTool" Version="7.0.0-alpha.0.23367.2">
282282
<Uri>https://github.com/dotnet/hotreload-utils</Uri>
283-
<Sha>0595e15def6557a758879ba1b48f95b9e08a6463</Sha>
283+
<Sha>75d6e441c8ee712e1bf466a51baaef4fe83b56ef</Sha>
284284
</Dependency>
285285
<Dependency Name="System.Runtime.Numerics.TestData" Version="7.0.0-beta.23179.6">
286286
<Uri>https://github.com/dotnet/runtime-assets</Uri>

eng/Versions.props

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,10 @@
157157
<MicrosoftDotNetXHarnessTestRunnersCommonVersion>7.0.0-prerelease.23309.1</MicrosoftDotNetXHarnessTestRunnersCommonVersion>
158158
<MicrosoftDotNetXHarnessTestRunnersXunitVersion>7.0.0-prerelease.23309.1</MicrosoftDotNetXHarnessTestRunnersXunitVersion>
159159
<MicrosoftDotNetXHarnessCLIVersion>7.0.0-prerelease.23309.1</MicrosoftDotNetXHarnessCLIVersion>
160+
<MicrosoftDotNetHotReloadUtilsGeneratorBuildToolVersion>7.0.0-alpha.0.23367.2</MicrosoftDotNetHotReloadUtilsGeneratorBuildToolVersion>
161+
<MicrosoftDotNetXHarnessTestRunnersCommonVersion>7.0.0-prerelease.23321.1</MicrosoftDotNetXHarnessTestRunnersCommonVersion>
162+
<MicrosoftDotNetXHarnessTestRunnersXunitVersion>7.0.0-prerelease.23321.1</MicrosoftDotNetXHarnessTestRunnersXunitVersion>
163+
<MicrosoftDotNetXHarnessCLIVersion>7.0.0-prerelease.23321.1</MicrosoftDotNetXHarnessCLIVersion>
160164
<MicrosoftDotNetHotReloadUtilsGeneratorBuildToolVersion>7.0.0-alpha.0.23226.5</MicrosoftDotNetHotReloadUtilsGeneratorBuildToolVersion>
161165
<XUnitVersion>2.4.2</XUnitVersion>
162166
<XUnitAnalyzersVersion>1.0.0</XUnitAnalyzersVersion>
@@ -174,10 +178,10 @@
174178
<!-- Docs -->
175179
<MicrosoftPrivateIntellisenseVersion>7.0.0-preview-20221010.1</MicrosoftPrivateIntellisenseVersion>
176180
<!-- ILLink -->
177-
<MicrosoftNETILLinkTasksVersion>7.0.100-1.23321.1</MicrosoftNETILLinkTasksVersion>
181+
<MicrosoftNETILLinkTasksVersion>7.0.100-1.23401.1</MicrosoftNETILLinkTasksVersion>
178182
<MicrosoftNETILLinkAnalyzerPackageVersion>$(MicrosoftNETILLinkTasksVersion)</MicrosoftNETILLinkAnalyzerPackageVersion>
179183
<!-- ICU -->
180-
<MicrosoftNETCoreRuntimeICUTransportVersion>7.0.0-rtm.23315.2</MicrosoftNETCoreRuntimeICUTransportVersion>
184+
<MicrosoftNETCoreRuntimeICUTransportVersion>7.0.0-rtm.23362.1</MicrosoftNETCoreRuntimeICUTransportVersion>
181185
<!-- MsQuic -->
182186
<MicrosoftNativeQuicMsQuicVersion>2.1.1</MicrosoftNativeQuicMsQuicVersion>
183187
<SystemNetMsQuicTransportVersion>7.0.0-alpha.1.22459.1</SystemNetMsQuicTransportVersion>

eng/native/ijw/IJW.cmake

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,21 @@ if (CLR_CMAKE_HOST_WIN32)
3131
set_target_properties(${targetName} PROPERTIES COMPILE_OPTIONS "${compileOptions}")
3232
endfunction()
3333

34+
function(add_ijw_msbuild_project_properties targetName ijwhost_target)
35+
# When we're building with MSBuild, we need to set some project properties
36+
# in case CMake has decided to use the SDK support.
37+
# We're dogfooding things, so we need to set settings in ways that the product doesn't quite support.
38+
# We don't actually need an installed/available target framework version here
39+
# since we are disabling implicit framework references. We just need a valid value, and net7.0 is valid.
40+
set_target_properties(${targetName} PROPERTIES
41+
DOTNET_TARGET_FRAMEWORK net7.0
42+
VS_GLOBAL_DisableImplicitFrameworkReferences true
43+
VS_GLOBAL_GenerateRuntimeConfigurationFiles false
44+
VS_PROJECT_IMPORT "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/SetIJWProperties.props")
45+
endfunction()
46+
3447
# 4365 - signed/unsigned mismatch
35-
# 4679 - Could not import member. This is an issue with IJW and static abstract methods in interfaces.
48+
# 4679 - Could not import member. This is an issue with IJW and static abstract methods in interfaces.
3649
add_compile_options(/wd4365 /wd4679)
3750

3851
# IJW

eng/native/ijw/SetIJWProperties.props

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<Project>
2+
<PropertyGroup>
3+
<!-- The C++/CLI targets don't let us set this in the project file where CMake lets us set project properties, so we set it in an imported project file where it will work. -->
4+
<UseIJWHost>false</UseIJWHost>
5+
</PropertyGroup>
6+
</Project>

src/coreclr/inc/clrconfigvalues.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,7 @@ RETAIL_CONFIG_DWORD_INFO(UNSUPPORTED_ProfAPI_ValidateNGENInstrumentation, W("Pro
490490

491491
#ifdef FEATURE_PERFMAP
492492
RETAIL_CONFIG_DWORD_INFO(EXTERNAL_PerfMapEnabled, W("PerfMapEnabled"), 0, "This flag is used on Linux to enable writing /tmp/perf-$pid.map. It is disabled by default")
493-
RETAIL_CONFIG_STRING_INFO(EXTERNAL_PerfMapJitDumpPath, W("PerfMapJitDumpPath"), "Specifies a path to write the perf jitdump file. Defaults to GetTempPathA()")
493+
RETAIL_CONFIG_STRING_INFO(EXTERNAL_PerfMapJitDumpPath, W("PerfMapJitDumpPath"), "Specifies a path to write the perf jitdump file. Defaults to /tmp")
494494
RETAIL_CONFIG_DWORD_INFO(EXTERNAL_PerfMapIgnoreSignal, W("PerfMapIgnoreSignal"), 0, "When perf map is enabled, this option will configure the specified signal to be accepted and ignored as a marker in the perf logs. It is disabled by default")
495495
RETAIL_CONFIG_DWORD_INFO(EXTERNAL_PerfMapShowOptimizationTiers, W("PerfMapShowOptimizationTiers"), 1, "Shows optimization tiers in the perf map for methods, as part of the symbol name. Useful for seeing separate stack frames for different optimization tiers of each method.")
496496
RETAIL_CONFIG_STRING_INFO(EXTERNAL_NativeImagePerfMapFormat, W("NativeImagePerfMapFormat"), "Specifies the format of native image perfmap files generated by crossgen. Valid options are RVA or OFFSET.")

src/coreclr/vm/perfinfo.cpp

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,13 @@
1010
#include "perfinfo.h"
1111
#include "pal.h"
1212

13-
PerfInfo::PerfInfo(int pid)
13+
PerfInfo::PerfInfo(int pid, const char* basePath)
1414
: m_Stream(nullptr)
1515
{
1616
LIMITED_METHOD_CONTRACT;
1717

18-
SString tempPath;
19-
if (!WszGetTempPath(tempPath))
20-
{
21-
return;
22-
}
23-
2418
SString path;
25-
path.Printf("%Sperfinfo-%d.map", tempPath.GetUnicode(), pid);
19+
path.Printf("%s/perfinfo-%d.map", basePath, pid);
2620
OpenFile(path);
2721
}
2822

src/coreclr/vm/perfinfo.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
*/
2121
class PerfInfo {
2222
public:
23-
PerfInfo(int pid);
23+
PerfInfo(int pid, const char* basePath);
2424
~PerfInfo();
2525
void LogImage(PEAssembly* pPEAssembly, WCHAR* guid);
2626

src/coreclr/vm/perfmap.cpp

Lines changed: 51 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,14 @@
1919

2020
#define FMT_CODE_ADDR "%p"
2121

22+
#ifndef __ANDROID__
23+
#define TEMP_DIRECTORY_PATH "/tmp"
24+
#else
25+
// On Android, "/tmp/" doesn't exist; temporary files should go to
26+
// /data/local/tmp/
27+
#define TEMP_DIRECTORY_PATH "/data/local/tmp"
28+
#endif
29+
2230
Volatile<bool> PerfMap::s_enabled = false;
2331
PerfMap * PerfMap::s_Current = nullptr;
2432
bool PerfMap::s_ShowOptimizationTiers = false;
@@ -37,55 +45,64 @@ void PerfMap::Initialize()
3745
{
3846
LIMITED_METHOD_CONTRACT;
3947

48+
const DWORD perfMapEnabled = CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_PerfMapEnabled);
49+
if (perfMapEnabled == DISABLED)
50+
{
51+
return;
52+
}
53+
54+
// Build the path to the map file on disk.
55+
char tempPathBuffer[MAX_LONGPATH+1];
56+
const char* tempPath = InternalConstructPath(tempPathBuffer, sizeof(tempPathBuffer));
57+
4058
// Only enable the map if requested.
41-
if (CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_PerfMapEnabled) == ALL || CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_PerfMapEnabled) == PERFMAP)
59+
if (perfMapEnabled == ALL || perfMapEnabled == PERFMAP)
4260
{
4361
// Get the current process id.
4462
int currentPid = GetCurrentProcessId();
4563

4664
// Create the map.
47-
s_Current = new PerfMap(currentPid);
65+
s_Current = new PerfMap(currentPid, tempPath);
4866

4967
int signalNum = (int) CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_PerfMapIgnoreSignal);
5068

5169
if (signalNum > 0)
5270
{
5371
PAL_IgnoreProfileSignal(signalNum);
5472
}
55-
56-
if (CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_PerfMapShowOptimizationTiers) != 0)
57-
{
58-
s_ShowOptimizationTiers = true;
59-
}
60-
61-
s_enabled = true;
6273
}
6374

64-
if (CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_PerfMapEnabled) == ALL || CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_PerfMapEnabled) == JITDUMP)
75+
// only enable JitDumps if requested
76+
if (perfMapEnabled == ALL || perfMapEnabled == JITDUMP)
6577
{
66-
const char* jitdumpPath;
67-
char jitdumpPathBuffer[4096];
78+
PAL_PerfJitDump_Start(tempPath);
79+
}
6880

69-
CLRConfigNoCache value = CLRConfigNoCache::Get("PerfMapJitDumpPath");
70-
if (value.IsSet())
71-
{
72-
jitdumpPath = value.AsString();
73-
}
74-
else
75-
{
76-
GetTempPathA(sizeof(jitdumpPathBuffer) - 1, jitdumpPathBuffer);
77-
jitdumpPath = jitdumpPathBuffer;
78-
}
81+
if (CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_PerfMapShowOptimizationTiers) != 0)
82+
{
83+
s_ShowOptimizationTiers = true;
84+
}
85+
86+
s_enabled = true;
87+
}
7988

80-
PAL_PerfJitDump_Start(jitdumpPath);
89+
// InternalConstructPath is guaranteed to return a non-null path
90+
// the function uses the input buffer only whe PerfMapJitDumpPath environment variable is set
91+
const char * PerfMap::InternalConstructPath(char *tmpBuf, int lenBuf)
92+
{
93+
DWORD len = GetEnvironmentVariableA("DOTNET_PerfMapJitDumpPath", tmpBuf, lenBuf);
94+
if (len == 0)
95+
{
96+
len = GetEnvironmentVariableA("COMPlus_PerfMapJitDumpPath", tmpBuf, lenBuf);
97+
}
8198

82-
if (CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_PerfMapShowOptimizationTiers) != 0)
83-
{
84-
s_ShowOptimizationTiers = true;
85-
}
86-
87-
s_enabled = true;
99+
if (len == 0 || // GetEnvironmentVariableA returns 0 if the variable is not found,
100+
len >= lenBuf) // or the length of the string not including the null terminator on success.
101+
{
102+
return TEMP_DIRECTORY_PATH;
88103
}
104+
105+
return tmpBuf;
89106
}
90107

91108
// Destroy the map for the process - called from EEShutdownHelper.
@@ -102,27 +119,21 @@ void PerfMap::Destroy()
102119
}
103120

104121
// Construct a new map for the process.
105-
PerfMap::PerfMap(int pid)
122+
PerfMap::PerfMap(int pid, const char* path)
106123
{
107124
LIMITED_METHOD_CONTRACT;
108125

109126
// Initialize with no failures.
110127
m_ErrorEncountered = false;
111128

112129
// Build the path to the map file on disk.
113-
WCHAR tempPath[MAX_LONGPATH+1];
114-
if(!GetTempPathW(MAX_LONGPATH, tempPath))
115-
{
116-
return;
117-
}
118-
119-
SString path;
120-
path.Printf("%Sperf-%d.map", &tempPath, pid);
130+
SString pathFile;
131+
pathFile.Printf("%s/perf-%d.map", path, pid);
121132

122133
// Open the map file for writing.
123-
OpenFile(path);
134+
OpenFile(pathFile);
124135

125-
m_PerfInfo = new PerfInfo(pid);
136+
m_PerfInfo = new PerfInfo(pid, path);
126137
}
127138

128139
// Construct a new map without a specified file name.

src/coreclr/vm/perfmap.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,10 @@ class PerfMap
3131
bool m_ErrorEncountered;
3232

3333
// Construct a new map for the specified pid.
34-
PerfMap(int pid);
34+
PerfMap(int pid, const char* path);
35+
36+
// Default to /tmp or use DOTNET_PerfMapJitDumpPath if set
37+
static const char* InternalConstructPath(char *tmpBuf, int lenBuf);
3538

3639
protected:
3740
// Indicates whether optimization tiers should be shown for methods in perf maps

src/installer/pkg/THIRD-PARTY-NOTICES.TXT

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ https://github.com/madler/zlib
7272
https://zlib.net/zlib_license.html
7373

7474
/* zlib.h -- interface of the 'zlib' general purpose compression library
75-
version 1.2.12, March 27th, 2022
75+
version 1.2.13, October 13th, 2022
7676

7777
Copyright (C) 1995-2022 Jean-loup Gailly and Mark Adler
7878

src/libraries/System.Globalization/tests/CultureInfo/CultureInfoCtor.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -254,8 +254,8 @@ public static IEnumerable<object[]> Ctor_String_TestData()
254254
yield return new object[] { "pa-IN", new [] { "pa-IN" }, true };
255255
yield return new object[] { "pl", new [] { "pl" } };
256256
yield return new object[] { "pl-PL", new [] { "pl-PL" } };
257-
yield return new object[] { "prs", new [] { "prs" }, true };
258-
yield return new object[] { "prs-AF", new [] { "prs-AF" }, true };
257+
yield return new object[] { "prs", new [] { "prs", "fa" }, true };
258+
yield return new object[] { "prs-AF", new [] { "prs-AF", "fa-AF" }, true};
259259
yield return new object[] { "ps", new [] { "ps" }, true };
260260
yield return new object[] { "ps-AF", new [] { "ps-AF" }, true };
261261
yield return new object[] { "pt", new [] { "pt" } };
@@ -460,7 +460,7 @@ public void TestCreationWithMangledSortName(string cultureName, string expectedC
460460
Assert.Equal(expectedSortName, ci.CompareInfo.Name);
461461
}
462462

463-
private static bool SupportRemoteExecutionWithIcu => RemoteExecutor.IsSupported && PlatformDetection.IsIcuGlobalization;
463+
private static bool SupportRemoteExecutionWithIcu => RemoteExecutor.IsSupported && PlatformDetection.IsIcuGlobalization && PlatformDetection.IsNotWindowsServerCore;
464464

465465
[InlineData("xx-u-XX", "xx-u-xx")]
466466
[InlineData("xx-u-XX-u-yy", "xx-u-xx-u-yy")]

src/libraries/System.Globalization/tests/NumberFormatInfo/NumberFormatInfoCurrencyGroupSizes.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,21 @@ public class NumberFormatInfoCurrencyGroupSizes
1010
{
1111
public static IEnumerable<object[]> CurrencyGroupSizes_TestData()
1212
{
13-
yield return new object[] { NumberFormatInfo.InvariantInfo, new int[] { 3 } };
14-
yield return new object[] { CultureInfo.GetCultureInfo("en-US").NumberFormat, new int[] { 3 } };
13+
yield return new object[] { NumberFormatInfo.InvariantInfo, new int[] { 3 }, null };
14+
yield return new object[] { CultureInfo.GetCultureInfo("en-US").NumberFormat, new int[] { 3 }, null };
1515

1616
if (PlatformDetection.IsNotUsingLimitedCultures && !PlatformDetection.IsUbuntu && !PlatformDetection.IsWindows7 && !PlatformDetection.IsWindows8x && !PlatformDetection.IsFedora)
1717
{
18-
yield return new object[] { CultureInfo.GetCultureInfo("ur-IN").NumberFormat, new int[] { 3, 2 } };
18+
yield return new object[] { CultureInfo.GetCultureInfo("ur-IN").NumberFormat, new int[] { 3, 2 }, new int[] { 3 }};
1919
}
2020
}
2121

2222
[Theory]
2323
[MemberData(nameof(CurrencyGroupSizes_TestData))]
24-
public void CurrencyGroupSizes_Get_ReturnsExpected(NumberFormatInfo format, int[] expected)
24+
public void CurrencyGroupSizes_Get_ReturnsExpected(NumberFormatInfo format, int[] expected, int [] expectedAlternative)
2525
{
26-
Assert.Equal(expected, format.CurrencyGroupSizes);
26+
Assert.True(format.CurrencyGroupSizes.AsSpan().SequenceEqual(expected.AsSpan()) || format.CurrencyGroupSizes.AsSpan().SequenceEqual(expectedAlternative.AsSpan()),
27+
$"Expected {string.Join(", ", expected)} or {string.Join(", ", expectedAlternative ?? Array.Empty<int>())}, got {string.Join(", ", format.CurrencyGroupSizes)}");
2728
}
2829

2930
[Theory]

0 commit comments

Comments
 (0)