diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 6123f232c0a978..3b2eedc5db0828 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,8 +1,8 @@ - + https://github.com/dotnet/icu - 18b103db239331f9b917e741b13c95eddf32f6df + 0397ca2c2ed47ae1c490edde1fac14ec7200eb71 https://github.com/dotnet/msquic @@ -102,49 +102,49 @@ https://github.com/microsoft/vstest 140434f7109d357d0158ade9e5164a4861513965 - + https://github.com/dotnet/runtime-assets - 60b420e88cdd0ec0becb2115e14288adc1a1cb55 + b642300c07f64ba35fdf1e2d2c4476107519f8f4 - + https://github.com/dotnet/runtime-assets - 60b420e88cdd0ec0becb2115e14288adc1a1cb55 + b642300c07f64ba35fdf1e2d2c4476107519f8f4 - + https://github.com/dotnet/runtime-assets - 60b420e88cdd0ec0becb2115e14288adc1a1cb55 + b642300c07f64ba35fdf1e2d2c4476107519f8f4 - + https://github.com/dotnet/runtime-assets - 60b420e88cdd0ec0becb2115e14288adc1a1cb55 + b642300c07f64ba35fdf1e2d2c4476107519f8f4 - + https://github.com/dotnet/runtime-assets - 60b420e88cdd0ec0becb2115e14288adc1a1cb55 + b642300c07f64ba35fdf1e2d2c4476107519f8f4 - + https://github.com/dotnet/runtime-assets - 60b420e88cdd0ec0becb2115e14288adc1a1cb55 + b642300c07f64ba35fdf1e2d2c4476107519f8f4 - + https://github.com/dotnet/runtime-assets - 60b420e88cdd0ec0becb2115e14288adc1a1cb55 + b642300c07f64ba35fdf1e2d2c4476107519f8f4 - + https://github.com/dotnet/runtime-assets - 60b420e88cdd0ec0becb2115e14288adc1a1cb55 + b642300c07f64ba35fdf1e2d2c4476107519f8f4 - + https://github.com/dotnet/runtime-assets - 60b420e88cdd0ec0becb2115e14288adc1a1cb55 + b642300c07f64ba35fdf1e2d2c4476107519f8f4 - + https://github.com/dotnet/runtime-assets - 60b420e88cdd0ec0becb2115e14288adc1a1cb55 + b642300c07f64ba35fdf1e2d2c4476107519f8f4 - + https://github.com/dotnet/runtime-assets - 60b420e88cdd0ec0becb2115e14288adc1a1cb55 + b642300c07f64ba35fdf1e2d2c4476107519f8f4 https://github.com/dotnet/llvm-project @@ -242,13 +242,13 @@ https://dev.azure.com/dnceng/internal/_git/dotnet-optimization d50065944d8b41d804448a7056351481d583ad3d - + https://github.com/dotnet/hotreload-utils - 2293d2ba069595f1c87f4e002c84cbab7201bfe7 + dd752be1a2fa9ea5c55fbbf1e28dc65902b3a476 - + https://github.com/dotnet/runtime-assets - 60b420e88cdd0ec0becb2115e14288adc1a1cb55 + b642300c07f64ba35fdf1e2d2c4476107519f8f4 https://github.com/dotnet/roslyn-analyzers diff --git a/eng/Versions.props b/eng/Versions.props index 293c900dc99925..b7b1e4fc0a3fd4 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -108,18 +108,18 @@ 4.5.0 6.0.0-rc.1.21415.6 - 6.0.0-beta.23316.2 - 6.0.0-beta.23316.2 - 6.0.0-beta.23316.2 - 6.0.0-beta.23316.2 - 6.0.0-beta.23316.2 - 6.0.0-beta.23316.2 - 6.0.0-beta.23316.2 - 6.0.0-beta.23316.2 - 6.0.0-beta.23316.2 - 6.0.0-beta.23316.2 - 6.0.0-beta.23316.2 - 6.0.0-beta.23316.2 + 6.0.0-beta.23410.1 + 6.0.0-beta.23410.1 + 6.0.0-beta.23410.1 + 6.0.0-beta.23410.1 + 6.0.0-beta.23410.1 + 6.0.0-beta.23410.1 + 6.0.0-beta.23410.1 + 6.0.0-beta.23410.1 + 6.0.0-beta.23410.1 + 6.0.0-beta.23410.1 + 6.0.0-beta.23410.1 + 6.0.0-beta.23410.1 1.0.0-prerelease.21416.5 1.0.0-prerelease.21416.5 @@ -145,7 +145,8 @@ 17.4.0-preview-20220707-01 6.0.0-prerelease.23401.2 6.0.0-prerelease.23401.2 - 6.0.0-alpha.0.23226.4 + 6.0.0-alpha.0.23411.2 + 6.0.0-alpha.0.23367.3 2.4.2-pre.9 2.4.2 1.3.0 @@ -162,7 +163,7 @@ 6.0.100-1.21459.1 $(MicrosoftNETILLinkTasksVersion) - 6.0.0-rtm.23315.1 + 6.0.0-rtm.23409.1 6.0.0-servicing.22205.1 diff --git a/src/coreclr/inc/clrconfigvalues.h b/src/coreclr/inc/clrconfigvalues.h index d06900034778ae..7f6698684f9fbf 100644 --- a/src/coreclr/inc/clrconfigvalues.h +++ b/src/coreclr/inc/clrconfigvalues.h @@ -526,7 +526,7 @@ RETAIL_CONFIG_DWORD_INFO(UNSUPPORTED_ProfAPI_ValidateNGENInstrumentation, W("Pro #ifdef FEATURE_PERFMAP 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") -RETAIL_CONFIG_STRING_INFO(EXTERNAL_PerfMapJitDumpPath, W("PerfMapJitDumpPath"), "Specifies a path to write the perf jitdump file. Defaults to GetTempPathA()") +RETAIL_CONFIG_STRING_INFO(EXTERNAL_PerfMapJitDumpPath, W("PerfMapJitDumpPath"), "Specifies a path to write the perf jitdump file. Defaults to /tmp") 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") 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.") 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.") diff --git a/src/coreclr/vm/perfinfo.cpp b/src/coreclr/vm/perfinfo.cpp index 869476ea0fd574..d3a7fc0238e54f 100644 --- a/src/coreclr/vm/perfinfo.cpp +++ b/src/coreclr/vm/perfinfo.cpp @@ -10,19 +10,13 @@ #include "perfinfo.h" #include "pal.h" -PerfInfo::PerfInfo(int pid) +PerfInfo::PerfInfo(int pid, const char* basePath) : m_Stream(nullptr) { LIMITED_METHOD_CONTRACT; - SString tempPath; - if (!WszGetTempPath(tempPath)) - { - return; - } - SString path; - path.Printf("%Sperfinfo-%d.map", tempPath.GetUnicode(), pid); + path.Printf("%s/perfinfo-%d.map", basePath, pid); OpenFile(path); } diff --git a/src/coreclr/vm/perfinfo.h b/src/coreclr/vm/perfinfo.h index 759a844f30925c..79305a03b6f2cb 100644 --- a/src/coreclr/vm/perfinfo.h +++ b/src/coreclr/vm/perfinfo.h @@ -20,7 +20,7 @@ */ class PerfInfo { public: - PerfInfo(int pid); + PerfInfo(int pid, const char* basePath); ~PerfInfo(); void LogImage(PEFile* pFile, WCHAR* guid); diff --git a/src/coreclr/vm/perfmap.cpp b/src/coreclr/vm/perfmap.cpp index 5eda731ec8bd0f..88bdd42dbe0279 100644 --- a/src/coreclr/vm/perfmap.cpp +++ b/src/coreclr/vm/perfmap.cpp @@ -22,6 +22,14 @@ #define FMT_CODE_ADDR "%p" #endif +#ifndef __ANDROID__ +#define TEMP_DIRECTORY_PATH "/tmp" +#else +// On Android, "/tmp/" doesn't exist; temporary files should go to +// /data/local/tmp/ +#define TEMP_DIRECTORY_PATH "/data/local/tmp" +#endif + Volatile PerfMap::s_enabled = false; PerfMap * PerfMap::s_Current = nullptr; bool PerfMap::s_ShowOptimizationTiers = false; @@ -40,14 +48,24 @@ void PerfMap::Initialize() { LIMITED_METHOD_CONTRACT; + const DWORD perfMapEnabled = CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_PerfMapEnabled); + if (perfMapEnabled == DISABLED) + { + return; + } + + // Build the path to the map file on disk. + char tempPathBuffer[MAX_LONGPATH+1]; + const char* tempPath = InternalConstructPath(tempPathBuffer, sizeof(tempPathBuffer)); + // Only enable the map if requested. - if (CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_PerfMapEnabled) == ALL || CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_PerfMapEnabled) == PERFMAP) + if (perfMapEnabled == ALL || perfMapEnabled == PERFMAP) { // Get the current process id. int currentPid = GetCurrentProcessId(); // Create the map. - s_Current = new PerfMap(currentPid); + s_Current = new PerfMap(currentPid, tempPath); int signalNum = (int) CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_PerfMapIgnoreSignal); @@ -55,38 +73,39 @@ void PerfMap::Initialize() { PAL_IgnoreProfileSignal(signalNum); } + } - if (CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_PerfMapShowOptimizationTiers) != 0) - { - s_ShowOptimizationTiers = true; - } - - s_enabled = true; + // only enable JitDumps if requested + if (perfMapEnabled == ALL || perfMapEnabled == JITDUMP) + { + PAL_PerfJitDump_Start(tempPath); } - if (CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_PerfMapEnabled) == ALL || CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_PerfMapEnabled) == JITDUMP) + if (CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_PerfMapShowOptimizationTiers) != 0) { - char jitdumpPath[4096]; - - // CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_PerfMapJitDumpPath) returns a LPWSTR - // Use GetEnvironmentVariableA because it is simpler. - // Keep comment here to make it searchable. - DWORD len = GetEnvironmentVariableA("COMPlus_PerfMapJitDumpPath", jitdumpPath, sizeof(jitdumpPath) - 1); - - if (len == 0) - { - GetTempPathA(sizeof(jitdumpPath) - 1, jitdumpPath); - } + s_ShowOptimizationTiers = true; + } + + s_enabled = true; +} - PAL_PerfJitDump_Start(jitdumpPath); +// InternalConstructPath is guaranteed to return a non-null path +// the function uses the input buffer only whe PerfMapJitDumpPath environment variable is set +const char * PerfMap::InternalConstructPath(char *tmpBuf, int lenBuf) +{ + DWORD len = GetEnvironmentVariableA("DOTNET_PerfMapJitDumpPath", tmpBuf, lenBuf); + if (len == 0) + { + len = GetEnvironmentVariableA("COMPlus_PerfMapJitDumpPath", tmpBuf, lenBuf); + } - if (CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_PerfMapShowOptimizationTiers) != 0) - { - s_ShowOptimizationTiers = true; - } - - s_enabled = true; + if (len == 0 || // GetEnvironmentVariableA returns 0 if the variable is not found, + len >= lenBuf) // or the length of the string not including the null terminator on success. + { + return TEMP_DIRECTORY_PATH; } + + return tmpBuf; } // Destroy the map for the process - called from EEShutdownHelper. @@ -103,7 +122,7 @@ void PerfMap::Destroy() } // Construct a new map for the process. -PerfMap::PerfMap(int pid) +PerfMap::PerfMap(int pid, const char* path) { LIMITED_METHOD_CONTRACT; @@ -111,19 +130,13 @@ PerfMap::PerfMap(int pid) m_ErrorEncountered = false; // Build the path to the map file on disk. - WCHAR tempPath[MAX_LONGPATH+1]; - if(!GetTempPathW(MAX_LONGPATH, tempPath)) - { - return; - } - - SString path; - path.Printf("%Sperf-%d.map", &tempPath, pid); + SString pathFile; + pathFile.Printf("%s/perf-%d.map", path, pid); // Open the map file for writing. - OpenFile(path); + OpenFile(pathFile); - m_PerfInfo = new PerfInfo(pid); + m_PerfInfo = new PerfInfo(pid, path); } // Construct a new map without a specified file name. diff --git a/src/coreclr/vm/perfmap.h b/src/coreclr/vm/perfmap.h index 636ac81830aa66..f9665f8b27f0c2 100644 --- a/src/coreclr/vm/perfmap.h +++ b/src/coreclr/vm/perfmap.h @@ -31,7 +31,10 @@ class PerfMap bool m_ErrorEncountered; // Construct a new map for the specified pid. - PerfMap(int pid); + PerfMap(int pid, const char* path); + + // Default to /tmp or use DOTNET_PerfMapJitDumpPath if set + static const char* InternalConstructPath(char *tmpBuf, int lenBuf); protected: // Indicates whether optimization tiers should be shown for methods in perf maps diff --git a/src/installer/tests/HostActivation.Tests/PortableAppActivation.cs b/src/installer/tests/HostActivation.Tests/PortableAppActivation.cs index b8fced8d26ea69..7819f3ed2f14d8 100644 --- a/src/installer/tests/HostActivation.Tests/PortableAppActivation.cs +++ b/src/installer/tests/HostActivation.Tests/PortableAppActivation.cs @@ -322,7 +322,8 @@ public void AppHost_FrameworkDependent_GlobalLocation_Succeeds(bool useRegistere .Execute() .Should().Pass() .And.HaveStdOutContaining("Hello World") - .And.HaveStdOutContaining(sharedTestState.RepoDirectories.MicrosoftNETCoreAppVersion); + .And.HaveStdOutContaining(sharedTestState.RepoDirectories.MicrosoftNETCoreAppVersion) + .And.NotHaveStdErr(); // Verify running from within the working directory Command.Create(appExe) @@ -336,7 +337,8 @@ public void AppHost_FrameworkDependent_GlobalLocation_Succeeds(bool useRegistere .Execute() .Should().Pass() .And.HaveStdOutContaining("Hello World") - .And.HaveStdOutContaining(sharedTestState.RepoDirectories.MicrosoftNETCoreAppVersion); + .And.HaveStdOutContaining(sharedTestState.RepoDirectories.MicrosoftNETCoreAppVersion) + .And.NotHaveStdErr(); } } diff --git a/src/installer/tests/HostActivation.Tests/StartupHooks.cs b/src/installer/tests/HostActivation.Tests/StartupHooks.cs index 3e1685356167f9..ab1f1846062162 100644 --- a/src/installer/tests/HostActivation.Tests/StartupHooks.cs +++ b/src/installer/tests/HostActivation.Tests/StartupHooks.cs @@ -179,7 +179,8 @@ public void Muxer_activation_of_Empty_StartupHook_Variable_Succeeds() .CaptureStdErr() .Execute() .Should().Pass() - .And.HaveStdOutContaining("Hello World"); + .And.HaveStdOutContaining("Hello World") + .And.NotHaveStdErr(); } // Run the app with a startup hook assembly that depends on assemblies not on the TPA list diff --git a/src/libraries/System.Globalization/tests/CultureInfo/CultureInfoCtor.cs b/src/libraries/System.Globalization/tests/CultureInfo/CultureInfoCtor.cs index 469add3f04fca0..493ab018fbc091 100644 --- a/src/libraries/System.Globalization/tests/CultureInfo/CultureInfoCtor.cs +++ b/src/libraries/System.Globalization/tests/CultureInfo/CultureInfoCtor.cs @@ -254,8 +254,8 @@ public static IEnumerable Ctor_String_TestData() yield return new object[] { "pa-IN", new [] { "pa-IN" }, true }; yield return new object[] { "pl", new [] { "pl" } }; yield return new object[] { "pl-PL", new [] { "pl-PL" } }; - yield return new object[] { "prs", new [] { "prs" }, true }; - yield return new object[] { "prs-AF", new [] { "prs-AF" }, true }; + yield return new object[] { "prs", new [] { "prs", "fa" }, true }; + yield return new object[] { "prs-AF", new [] { "prs-AF", "fa-AF" }, true }; yield return new object[] { "ps", new [] { "ps" }, true }; yield return new object[] { "ps-AF", new [] { "ps-AF" }, true }; yield return new object[] { "pt", new [] { "pt" } }; @@ -441,7 +441,7 @@ public void TestCreationWithTemporaryLCID(int lcid) Assert.NotEqual(lcid, new CultureInfo(lcid).LCID); } - private static bool NotWasmWithIcu => PlatformDetection.IsNotBrowser && PlatformDetection.IsIcuGlobalization; + private static bool NotWasmWithIcu => PlatformDetection.IsNotBrowser && PlatformDetection.IsIcuGlobalization && PlatformDetection.IsNotWindowsServerCore; [InlineData("zh-TW-u-co-zhuyin", "zh-TW", "zh-TW_zhuyin")] [InlineData("de-DE-u-co-phonebk", "de-DE", "de-DE_phoneboo")] diff --git a/src/libraries/System.Globalization/tests/NumberFormatInfo/NumberFormatInfoCurrencyGroupSizes.cs b/src/libraries/System.Globalization/tests/NumberFormatInfo/NumberFormatInfoCurrencyGroupSizes.cs index 34fd7bc00cb2b7..741eb25c6a3a3a 100644 --- a/src/libraries/System.Globalization/tests/NumberFormatInfo/NumberFormatInfoCurrencyGroupSizes.cs +++ b/src/libraries/System.Globalization/tests/NumberFormatInfo/NumberFormatInfoCurrencyGroupSizes.cs @@ -10,20 +10,21 @@ public class NumberFormatInfoCurrencyGroupSizes { public static IEnumerable CurrencyGroupSizes_TestData() { - yield return new object[] { NumberFormatInfo.InvariantInfo, new int[] { 3 } }; - yield return new object[] { CultureInfo.GetCultureInfo("en-US").NumberFormat, new int[] { 3 } }; + yield return new object[] { NumberFormatInfo.InvariantInfo, new int[] { 3 }, null }; + yield return new object[] { CultureInfo.GetCultureInfo("en-US").NumberFormat, new int[] { 3 }, null }; if (PlatformDetection.IsNotUsingLimitedCultures && !PlatformDetection.IsUbuntu && !PlatformDetection.IsWindows7 && !PlatformDetection.IsWindows8x && !PlatformDetection.IsFedora) { - yield return new object[] { CultureInfo.GetCultureInfo("ur-IN").NumberFormat, new int[] { 3, 2 } }; + yield return new object[] { CultureInfo.GetCultureInfo("ur-IN").NumberFormat, new int[] { 3, 2 }, new int[] { 3 }}; } } [Theory] [MemberData(nameof(CurrencyGroupSizes_TestData))] - public void CurrencyGroupSizes_Get_ReturnsExpected(NumberFormatInfo format, int[] expected) + public void CurrencyGroupSizes_Get_ReturnsExpected(NumberFormatInfo format, int[] expected, int[] expectedAlternative) { - Assert.Equal(expected, format.CurrencyGroupSizes); + Assert.True(format.CurrencyGroupSizes.AsSpan().SequenceEqual(expected.AsSpan()) || format.CurrencyGroupSizes.AsSpan().SequenceEqual(expectedAlternative.AsSpan()), + $"Expected {string.Join(", ", expected)} or {string.Join(", ", expectedAlternative ?? Array.Empty())}, got {string.Join(", ", format.CurrencyGroupSizes)}"); } [Theory] diff --git a/src/libraries/System.Globalization/tests/NumberFormatInfo/NumberFormatInfoTests.cs b/src/libraries/System.Globalization/tests/NumberFormatInfo/NumberFormatInfoTests.cs index 9ff172194fd786..c5abe421df1985 100644 --- a/src/libraries/System.Globalization/tests/NumberFormatInfo/NumberFormatInfoTests.cs +++ b/src/libraries/System.Globalization/tests/NumberFormatInfo/NumberFormatInfoTests.cs @@ -54,8 +54,6 @@ public static IEnumerable DigitSubstitution_TestData() yield return new object[] { "nqo-GN" , DigitShapes.NativeNational }; yield return new object[] { "pa-Arab" , DigitShapes.NativeNational }; yield return new object[] { "pa-Arab-PK", DigitShapes.NativeNational }; - yield return new object[] { "prs" , DigitShapes.NativeNational }; - yield return new object[] { "prs-AF" , DigitShapes.NativeNational }; yield return new object[] { "ps" , DigitShapes.NativeNational }; yield return new object[] { "ps-AF" , DigitShapes.NativeNational }; yield return new object[] { "sd" , DigitShapes.NativeNational }; @@ -115,5 +113,22 @@ public void DigitSubstitutionListTest(string cultureName, DigitShapes shape) } } + [Theory] + [InlineData("prs")] + [InlineData("prs-AF")] + public void PrsNativeDigitsTest(string cultureName) + { + try + { + CultureInfo ci = CultureInfo.GetCultureInfo(cultureName); + + // Some OS's set the DigitSubstitution to Context for the culture "prs" and "prs-AF". Majority of Os's set it to NativeNational. + Assert.True(ci.NumberFormat.DigitSubstitution == DigitShapes.Context || ci.NumberFormat.DigitSubstitution == DigitShapes.NativeNational); + } + catch (CultureNotFoundException) + { + // ignore the cultures that we cannot create as it is not supported on the platforms + } + } } } diff --git a/src/libraries/System.Security.Cryptography.X509Certificates/tests/PfxIterationCountTests.CustomAppDomainDataLimit.cs b/src/libraries/System.Security.Cryptography.X509Certificates/tests/PfxIterationCountTests.CustomAppDomainDataLimit.cs index 6ed0734deaa635..e61ba53f9359b3 100644 --- a/src/libraries/System.Security.Cryptography.X509Certificates/tests/PfxIterationCountTests.CustomAppDomainDataLimit.cs +++ b/src/libraries/System.Security.Cryptography.X509Certificates/tests/PfxIterationCountTests.CustomAppDomainDataLimit.cs @@ -6,6 +6,7 @@ using System.Collections.Generic; using System.Linq; using System.Security.Cryptography.X509Certificates; +using Test.Cryptography; using Xunit; namespace System.Security.Cryptography.X509Certificates.Tests @@ -18,7 +19,7 @@ public class PfxIterationCountTests_CustomAppDomainDataLimit [ConditionalTheory(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [MemberData(memberName: nameof(PfxIterationCountTests.GetCertsWith_IterationCountNotExceedingDefaultLimit_AndNullOrEmptyPassword_MemberData), MemberType = typeof(PfxIterationCountTests))] - public void Import_AppDomainDataWithValueTwo_ActsAsDefaultLimit_IterationCountNotExceedingDefaultLimit(string name, bool usesPbes2, byte[] blob, long iterationCount) + public void Import_AppDomainDataWithValueTwo_ActsAsDefaultLimit_IterationCountNotExceedingDefaultLimit(string name, bool usesPbes2, byte[] blob, long iterationCount, bool usesRC2) { _ = iterationCount; _ = blob; @@ -28,6 +29,11 @@ public void Import_AppDomainDataWithValueTwo_ActsAsDefaultLimit_IterationCountNo throw new SkipTestException(name + " uses PBES2 which is not supported on this version."); } + if (usesRC2 && !PlatformSupport.IsRC2Supported) + { + throw new SkipTestException(name + " uses RC2, which is not supported on this platform."); + } + RemoteExecutor.Invoke((certName) => { AppDomain.CurrentDomain.SetData("System.Security.Cryptography.Pkcs12UnspecifiedPasswordIterationLimit", -2); @@ -41,7 +47,7 @@ public void Import_AppDomainDataWithValueTwo_ActsAsDefaultLimit_IterationCountNo [ConditionalTheory(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [MemberData(memberName: nameof(PfxIterationCountTests.GetCertsWith_IterationCountExceedingDefaultLimit_MemberData), MemberType = typeof(PfxIterationCountTests))] - public void Import_AppDomainDataWithValueTwo_ActsAsDefaultLimit_IterationCountLimitExceeded_Throws(string name, string password, bool usesPbes2, byte[] blob, long iterationCount) + public void Import_AppDomainDataWithValueTwo_ActsAsDefaultLimit_IterationCountLimitExceeded_Throws(string name, string password, bool usesPbes2, byte[] blob, long iterationCount, bool usesRC2) { _ = password; _ = iterationCount; @@ -52,6 +58,11 @@ public void Import_AppDomainDataWithValueTwo_ActsAsDefaultLimit_IterationCountLi throw new SkipTestException(name + " uses PBES2 which is not supported on this version."); } + if (usesRC2 && !PlatformSupport.IsRC2Supported) + { + throw new SkipTestException(name + " uses RC2, which is not supported on this platform."); + } + RemoteExecutor.Invoke((certName) => { AppDomain.CurrentDomain.SetData("System.Security.Cryptography.Pkcs12UnspecifiedPasswordIterationLimit", -2); @@ -65,7 +76,7 @@ public void Import_AppDomainDataWithValueTwo_ActsAsDefaultLimit_IterationCountLi [ConditionalTheory(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [MemberData(memberName: nameof(PfxIterationCountTests.GetCertsWith_IterationCountNotExceedingDefaultLimit_AndNullOrEmptyPassword_MemberData), MemberType = typeof(PfxIterationCountTests))] - public void Import_AppDomainDataWithValueZero_IterationCountNotExceedingDefaultLimit_Throws(string name, bool usesPbes2, byte[] blob, long iterationCount) + public void Import_AppDomainDataWithValueZero_IterationCountNotExceedingDefaultLimit_Throws(string name, bool usesPbes2, byte[] blob, long iterationCount, bool usesRC2) { _ = iterationCount; _ = blob; @@ -75,6 +86,11 @@ public void Import_AppDomainDataWithValueZero_IterationCountNotExceedingDefaultL throw new SkipTestException(name + " uses PBES2 which is not supported on this version."); } + if (usesRC2 && !PlatformSupport.IsRC2Supported) + { + throw new SkipTestException(name + " uses RC2, which is not supported on this platform."); + } + RemoteExecutor.Invoke((certName) => { AppDomain.CurrentDomain.SetData("System.Security.Cryptography.Pkcs12UnspecifiedPasswordIterationLimit", 0); @@ -88,7 +104,7 @@ public void Import_AppDomainDataWithValueZero_IterationCountNotExceedingDefaultL [ConditionalTheory(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [MemberData(memberName: nameof(PfxIterationCountTests.GetCertsWith_IterationCountExceedingDefaultLimit_MemberData), MemberType = typeof(PfxIterationCountTests))] - public void Import_AppDomainDataWithValueMinusOne_IterationCountExceedingDefaultLimit(string name, string password, bool usesPbes2, byte[] blob, long iterationCount) + public void Import_AppDomainDataWithValueMinusOne_IterationCountExceedingDefaultLimit(string name, string password, bool usesPbes2, byte[] blob, long iterationCount, bool usesRC2) { _ = password; _ = blob; @@ -99,6 +115,11 @@ public void Import_AppDomainDataWithValueMinusOne_IterationCountExceedingDefault throw new SkipTestException(name + " uses PBES2 which is not supported on this version."); } + if (usesRC2 && !PlatformSupport.IsRC2Supported) + { + throw new SkipTestException(name + " uses RC2, which is not supported on this platform."); + } + RemoteExecutor.Invoke((certName) => { AppDomain.CurrentDomain.SetData("System.Security.Cryptography.Pkcs12UnspecifiedPasswordIterationLimit", -1); diff --git a/src/libraries/System.Security.Cryptography.X509Certificates/tests/PfxIterationCountTests.cs b/src/libraries/System.Security.Cryptography.X509Certificates/tests/PfxIterationCountTests.cs index 18ab1381a026f7..234ec5bf3e6224 100644 --- a/src/libraries/System.Security.Cryptography.X509Certificates/tests/PfxIterationCountTests.cs +++ b/src/libraries/System.Security.Cryptography.X509Certificates/tests/PfxIterationCountTests.cs @@ -22,13 +22,18 @@ public abstract partial class PfxIterationCountTests [ConditionalTheory] [MemberData(nameof(GetCertsWith_IterationCountNotExceedingDefaultLimit_AndNullOrEmptyPassword_MemberData))] - public void Import_IterationCounLimitNotExceeded_Succeeds(string name, bool usesPbes2, byte[] blob, long iterationCount) + public void Import_IterationCounLimitNotExceeded_Succeeds(string name, bool usesPbes2, byte[] blob, long iterationCount, bool usesRC2) { if (usesPbes2 && !PfxTests.Pkcs12PBES2Supported) { throw new SkipTestException(name + " uses PBES2 which is not supported on this version."); } + if (usesRC2 && !PlatformSupport.IsRC2Supported) + { + throw new SkipTestException(name + " uses RC2, which is not supported on this platform."); + } + if (PfxTests.IsPkcs12IterationCountAllowed(iterationCount, PfxTests.DefaultIterations)) { X509Certificate cert = Import(blob); @@ -38,7 +43,7 @@ public void Import_IterationCounLimitNotExceeded_Succeeds(string name, bool uses [ConditionalTheory] [MemberData(nameof(GetCertsWith_IterationCountExceedingDefaultLimit_MemberData))] - public void Import_IterationCountLimitExceeded_Throws(string name, string password, bool usesPbes2, byte[] blob, long iterationCount) + public void Import_IterationCountLimitExceeded_Throws(string name, string password, bool usesPbes2, byte[] blob, long iterationCount, bool usesRC2) { _ = password; _ = iterationCount; @@ -48,19 +53,29 @@ public void Import_IterationCountLimitExceeded_Throws(string name, string passwo throw new SkipTestException(name + " uses PBES2 which is not supported on this version."); } + if (usesRC2 && !PlatformSupport.IsRC2Supported) + { + throw new SkipTestException(name + " uses RC2, which is not supported on this platform."); + } + CryptographicException ce = Assert.Throws(() => Import(blob)); Assert.Contains("2233907", ce.Message); } [ConditionalTheory] [MemberData(nameof(GetCertsWith_IterationCountExceedingDefaultLimit_MemberData))] - public void ImportWithPasswordOrFileName_IterationCountLimitExceeded(string name, string password, bool usesPbes2, byte[] blob, long iterationCount) + public void ImportWithPasswordOrFileName_IterationCountLimitExceeded(string name, string password, bool usesPbes2, byte[] blob, long iterationCount, bool usesRC2) { if (usesPbes2 && !PfxTests.Pkcs12PBES2Supported) { throw new SkipTestException(name + " uses PBES2 which is not supported on this version."); } + if (usesRC2 && !PlatformSupport.IsRC2Supported) + { + throw new SkipTestException(name + " uses RC2, which is not supported on this platform."); + } + using (TempFileHolder tempFile = new TempFileHolder(blob)) { string fileName = tempFile.FilePath; @@ -99,13 +114,18 @@ internal static void VerifyThrowsCryptoExButDoesNotThrowPfxWithoutPassword(Actio [ConditionalTheory] [MemberData(nameof(GetCertsWith_NonNullOrEmptyPassword_MemberData))] - public void Import_NonNullOrEmptyPasswordExpected_Throws(string name, string password, bool usesPbes2, byte[] blob, long iterationCount) + public void Import_NonNullOrEmptyPasswordExpected_Throws(string name, string password, bool usesPbes2, byte[] blob, long iterationCount, bool usesRC2) { if (usesPbes2 && !PfxTests.Pkcs12PBES2Supported) { throw new SkipTestException(name + " uses PBES2 which is not supported on this version."); } + if (usesRC2 && !PlatformSupport.IsRC2Supported) + { + throw new SkipTestException(name + " uses RC2, which is not supported on this platform."); + } + CryptographicException ce = Assert.ThrowsAny(() => Import(blob)); if (PfxTests.IsPkcs12IterationCountAllowed(iterationCount, PfxTests.DefaultIterations)) @@ -139,7 +159,7 @@ internal static List GetCertificates() certificates.Add(new PfxInfo( nameof(TestData.Pkcs12WindowsDotnetExportEmptyPassword), "", 6000, false, TestData.Pkcs12WindowsDotnetExportEmptyPassword.HexToByteArray())); certificates.Add(new PfxInfo( - nameof(TestData.Pkcs12MacosKeychainCreated), null, 4097, false, TestData.Pkcs12MacosKeychainCreated.HexToByteArray())); + nameof(TestData.Pkcs12MacosKeychainCreated), null, 4097, false, TestData.Pkcs12MacosKeychainCreated.HexToByteArray(), usesRC2: true)); certificates.Add(new PfxInfo( nameof(TestData.Pkcs12BuilderSaltWithMacNullPassword), null, 120000, true, TestData.Pkcs12BuilderSaltWithMacNullPassword.HexToByteArray())); certificates.Add(new PfxInfo( @@ -162,7 +182,7 @@ public static IEnumerable GetCertsWith_IterationCountNotExceedingDefau c => c.IterationCount <= DefaultIterationLimit && string.IsNullOrEmpty(c.Password))) { - yield return new object[] { p.Name, p.UsesPbes2, p.Blob, p.IterationCount }; + yield return new object[] { p.Name, p.UsesPbes2, p.Blob, p.IterationCount, p.UsesRC2 }; } } @@ -170,7 +190,7 @@ public static IEnumerable GetCertsWith_IterationCountExceedingDefaultL { foreach (PfxInfo p in s_Certificates.Where(c => c.IterationCount > DefaultIterationLimit)) { - yield return new object[] { p.Name, p.Password, p.UsesPbes2, p.Blob, p.IterationCount }; + yield return new object[] { p.Name, p.Password, p.UsesPbes2, p.Blob, p.IterationCount, p.UsesRC2 }; } } @@ -178,7 +198,7 @@ public static IEnumerable GetCertsWith_NonNullOrEmptyPassword_MemberDa { foreach(PfxInfo p in s_Certificates.Where(c => !string.IsNullOrEmpty(c.Password))) { - yield return new object[] { p.Name, p.Password, p.UsesPbes2, p.Blob, p.IterationCount }; + yield return new object[] { p.Name, p.Password, p.UsesPbes2, p.Blob, p.IterationCount, p.UsesRC2 }; } } } @@ -190,14 +210,16 @@ public class PfxInfo internal long IterationCount { get; set; } internal bool UsesPbes2 { get; set; } internal byte[] Blob { get; set; } + internal bool UsesRC2 { get; set; } - internal PfxInfo(string name, string? password, long iterationCount, bool usesPbes2, byte[] blob) + internal PfxInfo(string name, string password, long iterationCount, bool usesPbes2, byte[] blob, bool usesRC2 = false) { Name = name; Password = password; IterationCount = iterationCount; UsesPbes2 = usesPbes2; Blob = blob; + UsesRC2 = usesRC2; } } } diff --git a/src/libraries/System.Security.Cryptography.X509Certificates/tests/PfxTests.cs b/src/libraries/System.Security.Cryptography.X509Certificates/tests/PfxTests.cs index f05849a64eb462..3c1669aa36573b 100644 --- a/src/libraries/System.Security.Cryptography.X509Certificates/tests/PfxTests.cs +++ b/src/libraries/System.Security.Cryptography.X509Certificates/tests/PfxTests.cs @@ -465,7 +465,7 @@ public static void CollectionPerphemeralImport_HasKeyName() [ConditionalTheory] [MemberData(memberName: nameof(PfxIterationCountTests.GetCertsWith_IterationCountNotExceedingDefaultLimit_AndNullOrEmptyPassword_MemberData), MemberType = typeof(PfxIterationCountTests))] - public static void TestIterationCounter(string name, bool usesPbes2, byte[] blob, int iterationCount) + public static void TestIterationCounter(string name, bool usesPbes2, byte[] blob, int iterationCount, bool usesRC2) { _ = iterationCount; @@ -477,6 +477,11 @@ public static void TestIterationCounter(string name, bool usesPbes2, byte[] blob throw new SkipTestException(name + " uses PBES2 which is not supported on this version."); } + if (usesRC2 && !PlatformSupport.IsRC2Supported) + { + throw new SkipTestException(name + " uses RC2, which is not supported on this platform."); + } + try { long count = (long)target(blob); diff --git a/src/mono/wasm/debugger/BrowserDebugHost/BrowserDebugHost.csproj b/src/mono/wasm/debugger/BrowserDebugHost/BrowserDebugHost.csproj index 66d0b287f76559..0efbe95332682c 100644 --- a/src/mono/wasm/debugger/BrowserDebugHost/BrowserDebugHost.csproj +++ b/src/mono/wasm/debugger/BrowserDebugHost/BrowserDebugHost.csproj @@ -4,6 +4,7 @@ $(AspNetCoreAppCurrent) true $(NoWarn),CA2007 + Major diff --git a/src/native/corehost/hostmisc/pal.windows.cpp b/src/native/corehost/hostmisc/pal.windows.cpp index c613d4240d34a6..cd6701879389d5 100644 --- a/src/native/corehost/hostmisc/pal.windows.cpp +++ b/src/native/corehost/hostmisc/pal.windows.cpp @@ -499,14 +499,18 @@ bool pal::getenv(const char_t* name, string_t* recv) auto err = GetLastError(); if (err != ERROR_ENVVAR_NOT_FOUND) { - trace::error(_X("Failed to read environment variable [%s], HRESULT: 0x%X"), name, HRESULT_FROM_WIN32(GetLastError())); + trace::warning(_X("Failed to read environment variable [%s], HRESULT: 0x%X"), name, HRESULT_FROM_WIN32(err)); } return false; } auto buf = new char_t[length]; if (::GetEnvironmentVariableW(name, buf, length) == 0) { - trace::error(_X("Failed to read environment variable [%s], HRESULT: 0x%X"), name, HRESULT_FROM_WIN32(GetLastError())); + auto err = GetLastError(); + if (err != ERROR_ENVVAR_NOT_FOUND) + { + trace::warning(_X("Failed to read environment variable [%s], HRESULT: 0x%X"), name, HRESULT_FROM_WIN32(err)); + } return false; } diff --git a/src/native/eventpipe/ds-ipc-pal-namedpipe.c b/src/native/eventpipe/ds-ipc-pal-namedpipe.c index 1bd3a202277204..6802d5aa28d42f 100644 --- a/src/native/eventpipe/ds-ipc-pal-namedpipe.c +++ b/src/native/eventpipe/ds-ipc-pal-namedpipe.c @@ -635,10 +635,8 @@ ds_ipc_close ( { EP_ASSERT (ipc != NULL); - // don't attempt cleanup on shutdown and let the OS handle it - // except in the case of listen pipes - if they leak the process - // will fail to reinitialize the pipe for embedding scenarios. - if (is_shutdown && ipc->mode != DS_IPC_CONNECTION_MODE_LISTEN) { + // don't attempt cleanup on shutdown and let the OS handle it. + if (is_shutdown) { if (callback) callback ("Closing without cleaning underlying handles", 100); return;