Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
33b5cd1
Merge in 'release/6.0' changes
dotnet-bot Dec 8, 2021
91c0c3e
Merge in 'release/6.0' changes
dotnet-bot Dec 13, 2021
19531cf
Merge in 'release/6.0' changes
dotnet-bot Dec 15, 2021
3263455
Merge in 'release/6.0' changes
dotnet-bot Dec 15, 2021
17d15a1
Merge in 'release/6.0' changes
dotnet-bot Dec 15, 2021
a3d65fd
Merge in 'release/6.0' changes
dotnet-bot Dec 15, 2021
b772c4a
Merge in 'release/6.0' changes
dotnet-bot Dec 15, 2021
3bb0e55
Merge in 'release/6.0' changes
dotnet-bot Dec 15, 2021
7585d47
Merge in 'release/6.0' changes
dotnet-bot Dec 15, 2021
59d7056
Merge in 'release/6.0' changes
dotnet-bot Dec 15, 2021
bcadac5
Merge in 'release/6.0' changes
dotnet-bot Dec 15, 2021
6c4fc3b
Merge in 'release/6.0' changes
dotnet-bot Dec 15, 2021
e6f0fe3
Merge in 'release/6.0' changes
dotnet-bot Dec 15, 2021
d71a66d
Merge in 'release/6.0' changes
dotnet-bot Dec 15, 2021
38be174
Merge in 'release/6.0' changes
dotnet-bot Dec 15, 2021
8d63400
Merge in 'release/6.0' changes
dotnet-bot Dec 15, 2021
cd08c36
Merge in 'release/6.0' changes
dotnet-bot Dec 15, 2021
2ab0eff
Merge in 'release/6.0' changes
dotnet-bot Dec 16, 2021
59d91e9
Merge in 'release/6.0' changes
dotnet-bot Dec 16, 2021
f5ca66e
Merge in 'release/6.0' changes
dotnet-bot Dec 16, 2021
58a13b7
Merge in 'release/6.0' changes
dotnet-bot Dec 16, 2021
fc77ea6
Merge in 'release/6.0' changes
dotnet-bot Dec 16, 2021
6a1bf49
Merge in 'release/6.0' changes
dotnet-bot Dec 17, 2021
c9e0054
Merge in 'release/6.0' changes
dotnet-bot Dec 17, 2021
3e71e1e
Merge in 'release/6.0' changes
dotnet-bot Dec 23, 2021
1415c71
Merge in 'release/6.0' changes
dotnet-bot Dec 31, 2021
bf5c4ec
Merge in 'release/6.0' changes
dotnet-bot Jan 3, 2022
5c543c7
Merge in 'release/6.0' changes
dotnet-bot Jan 3, 2022
f66e95c
Merge in 'release/6.0' changes
dotnet-bot Jan 3, 2022
6dbf89d
Merge in 'release/6.0' changes
dotnet-bot Jan 3, 2022
064d131
Merge in 'release/6.0' changes
dotnet-bot Jan 3, 2022
531c3fb
Merge in 'release/6.0' changes
dotnet-bot Jan 4, 2022
9348c0f
Merge in 'release/6.0' changes
dotnet-bot Jan 5, 2022
fcd07dc
Merge in 'release/6.0' changes
dotnet-bot Jan 6, 2022
b484b69
Merge in 'release/6.0' changes
dotnet-bot Jan 6, 2022
d9163ed
Merge in 'release/6.0' changes
dotnet-bot Jan 6, 2022
72fb99c
Merge in 'release/6.0' changes
dotnet-bot Jan 6, 2022
84d8fd3
Merge in 'release/6.0' changes
dotnet-bot Jan 6, 2022
639c1b9
Merge in 'release/6.0' changes
dotnet-bot Jan 7, 2022
48e8304
Merge in 'release/6.0' changes
dotnet-bot Jan 7, 2022
bf4854f
Merge in 'release/6.0' changes
dotnet-bot Jan 7, 2022
0d4706a
Merge in 'release/6.0' changes
dotnet-bot Jan 7, 2022
ad8231c
Merge in 'release/6.0' changes
dotnet-bot Jan 7, 2022
3e07e04
Merge in 'release/6.0' changes
dotnet-bot Jan 8, 2022
3e05a74
Merge in 'release/6.0' changes
dotnet-bot Jan 8, 2022
46fc58e
Merge in 'release/6.0' changes
dotnet-bot Jan 8, 2022
4c50598
Merge in 'release/6.0' changes
dotnet-bot Jan 8, 2022
4fd8dc2
Merge in 'release/6.0' changes
dotnet-bot Jan 8, 2022
42bbedf
Merge in 'release/6.0' changes
dotnet-bot Jan 8, 2022
2b2f871
Merge in 'release/6.0' changes
dotnet-bot Jan 8, 2022
b974f5c
Merge in 'release/6.0' changes
dotnet-bot Jan 10, 2022
f528972
Merge in 'release/6.0' changes
dotnet-bot Jan 10, 2022
27eb94b
Merge in 'release/6.0' changes
dotnet-bot Jan 10, 2022
56c11f2
Merge in 'release/6.0' changes
dotnet-bot Jan 10, 2022
5e9fd16
Merge in 'release/6.0' changes
dotnet-bot Jan 13, 2022
d8f7045
Merge in 'release/6.0' changes
dotnet-bot Jan 13, 2022
71075a0
Merge in 'release/6.0' changes
dotnet-bot Jan 13, 2022
839cdfb
Merge in 'release/6.0' changes
dotnet-bot Jan 14, 2022
373c15f
Merge commit '839cdfb0ecca5e0be3dbccd926e7651ef50fdf10' into internal…
vseanreesermsft Feb 8, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 59 additions & 0 deletions src/installer/tests/HostActivation.Tests/StartupHooks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public class StartupHooks : IClassFixture<StartupHooks.SharedTestState>
{
private SharedTestState sharedTestState;
private string startupHookVarName = "DOTNET_STARTUP_HOOKS";
private string startupHookRuntimeConfigName = "STARTUP_HOOKS";
private string startupHookSupport = "System.StartupHookProvider.IsSupported";

public StartupHooks(StartupHooks.SharedTestState fixture)
Expand Down Expand Up @@ -105,6 +106,64 @@ public void Muxer_activation_of_Multiple_StartupHooks_Succeeds()
.And.HaveStdOutContaining("Hello World");
}

[Fact]
public void Muxer_activation_of_RuntimeConfig_StartupHook_Succeeds()
{
var fixture = sharedTestState.PortableAppFixture.Copy();
var dotnet = fixture.BuiltDotnet;
var appDll = fixture.TestProject.AppDll;

var startupHookFixture = sharedTestState.StartupHookFixture.Copy();
var startupHookDll = startupHookFixture.TestProject.AppDll;

RuntimeConfig.FromFile(fixture.TestProject.RuntimeConfigJson)
.WithProperty(startupHookRuntimeConfigName, startupHookDll)
.Save();

// RuntimeConfig defined startup hook
dotnet.Exec(appDll)
.CaptureStdOut()
.CaptureStdErr()
.Execute()
.Should().Pass()
.And.HaveStdOutContaining("Hello from startup hook!")
.And.HaveStdOutContaining("Hello World");
}

[Fact]
public void Muxer_activation_of_RuntimeConfig_And_Environment_StartupHooks_SucceedsInExpectedOrder()
{
var fixture = sharedTestState.PortableAppFixture.Copy();
var dotnet = fixture.BuiltDotnet;
var appDll = fixture.TestProject.AppDll;

var startupHookFixture = sharedTestState.StartupHookFixture.Copy();
var startupHookDll = startupHookFixture.TestProject.AppDll;

RuntimeConfig.FromFile(fixture.TestProject.RuntimeConfigJson)
.WithProperty(startupHookRuntimeConfigName, startupHookDll)
.Save();

var startupHook2Fixture = sharedTestState.StartupHookWithDependencyFixture.Copy();
var startupHook2Dll = startupHook2Fixture.TestProject.AppDll;

// include any char to counter output from other threads such as in #57243
const string wildcardPattern = @"[\r\n\s.]*";

// RuntimeConfig and Environment startup hooks in expected order
dotnet.Exec(appDll)
.EnvironmentVariable(startupHookVarName, startupHook2Dll)
.CaptureStdOut()
.CaptureStdErr()
.Execute()
.Should().Pass()
.And.HaveStdOutMatching("Hello from startup hook with dependency!" +
wildcardPattern +
"Hello from startup hook!" +
wildcardPattern +
"Hello World");
}

// Empty startup hook variable
[Fact]
public void Muxer_activation_of_Empty_StartupHook_Variable_Succeeds()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ public static IEnumerable<object[]> ToLower_TestData()
}
yield return new object[] { cultureName, "\u0130", "i" };
yield return new object[] { cultureName, "i", "i" };

}

// ICU has special tailoring for the en-US-POSIX locale which treats "i" and "I" as different letters
Expand Down Expand Up @@ -478,5 +478,13 @@ public void ToStringTest(string name, string expected)
{
Assert.Equal(expected, new CultureInfo(name).TextInfo.ToString());
}

[ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))]
[InlineData("es-ES")]
[InlineData("es-ES_tradnl")]
public void TestAsciiCodePageWithCulturesWithAlternativeSortNames(string cultureName)
{
Assert.Equal(1252, CultureInfo.GetCultureInfo(cultureName).TextInfo.ANSICodePage);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ internal static unsafe int GetLocaleInfoEx(string lpLocaleName, uint lcType, cha
private string NlsGetLocaleInfo(LocaleStringData type)
{
Debug.Assert(ShouldUseUserOverrideNlsData);
Debug.Assert(_sWindowsName != null, "[CultureData.DoGetLocaleInfo] Expected _sWindowsName to be populated by already");
return NlsGetLocaleInfo(_sWindowsName, type);
Debug.Assert(_sRealName != null, "[CultureData.DoGetLocaleInfo] Expected _sRealName to be populated by already");
return NlsGetLocaleInfo(_sRealName, type);
}

// For LOCALE_SPARENT we need the option of using the "real" name (forcing neutral names) instead of the
Expand All @@ -74,15 +74,15 @@ private int NlsGetLocaleInfo(LocaleNumberData type)

// Ask OS for data, note that we presume it returns success, so we have to know that
// sWindowsName is valid before calling.
Debug.Assert(_sWindowsName != null, "[CultureData.DoGetLocaleInfoInt] Expected _sWindowsName to be populated by already");
return GetLocaleInfoExInt(_sWindowsName, lctype);
Debug.Assert(_sRealName != null, "[CultureData.DoGetLocaleInfoInt] Expected _sRealName to be populated already");
return GetLocaleInfoExInt(_sRealName, lctype);
}

private int[] NlsGetLocaleInfo(LocaleGroupingData type)
{
Debug.Assert(ShouldUseUserOverrideNlsData);
Debug.Assert(_sWindowsName != null, "[CultureData.DoGetLocaleInfoInt] Expected _sWindowsName to be populated by already");
return ConvertWin32GroupString(GetLocaleInfoFromLCType(_sWindowsName, (uint)type, _bUseOverrides));
Debug.Assert(_sRealName != null, "[CultureData.DoGetLocaleInfoInt] Expected _sRealName to be populated by already");
return ConvertWin32GroupString(GetLocaleInfoFromLCType(_sRealName, (uint)type, _bUseOverrides));
}

internal static bool NlsIsEnsurePredefinedLocaleName(string name)
Expand All @@ -94,16 +94,16 @@ internal static bool NlsIsEnsurePredefinedLocaleName(string name)
private string? NlsGetTimeFormatString()
{
Debug.Assert(ShouldUseUserOverrideNlsData);
Debug.Assert(_sWindowsName != null, "[CultureData.DoGetLocaleInfoInt] Expected _sWindowsName to be populated by already");
return ReescapeWin32String(GetLocaleInfoFromLCType(_sWindowsName, Interop.Kernel32.LOCALE_STIMEFORMAT, _bUseOverrides));
Debug.Assert(_sRealName != null, "[CultureData.DoGetLocaleInfoInt] Expected _sRealName to be populated by already");
return ReescapeWin32String(GetLocaleInfoFromLCType(_sRealName, Interop.Kernel32.LOCALE_STIMEFORMAT, _bUseOverrides));
}

private int NlsGetFirstDayOfWeek()
{
Debug.Assert(ShouldUseUserOverrideNlsData);
Debug.Assert(_sWindowsName != null, "[CultureData.DoGetLocaleInfoInt] Expected _sWindowsName to be populated by already");
Debug.Assert(_sRealName != null, "[CultureData.DoGetLocaleInfoInt] Expected _sRealName to be populated by already");

int result = GetLocaleInfoExInt(_sWindowsName, Interop.Kernel32.LOCALE_IFIRSTDAYOFWEEK | (!_bUseOverrides ? Interop.Kernel32.LOCALE_NOUSEROVERRIDE : 0));
int result = GetLocaleInfoExInt(_sRealName, Interop.Kernel32.LOCALE_IFIRSTDAYOFWEEK | (!_bUseOverrides ? Interop.Kernel32.LOCALE_NOUSEROVERRIDE : 0));

// Win32 and .NET disagree on the numbering for days of the week, so we have to convert.
return ConvertFirstDayOfWeekMonToSun(result);
Expand Down Expand Up @@ -529,7 +529,7 @@ internal bool NlsIsReplacementCulture

for (int i = 0; i < context.strings.Count; i++)
{
if (string.Equals(context.strings[i], _sWindowsName, StringComparison.OrdinalIgnoreCase))
if (string.Equals(context.strings[i], _sRealName, StringComparison.OrdinalIgnoreCase))
return true;
}

Expand Down
17 changes: 11 additions & 6 deletions src/native/corehost/hostpolicy/hostpolicy_context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -287,11 +287,16 @@ int hostpolicy_context_t::initialize(hostpolicy_init_t &hostpolicy_init, const a
pal::string_t startup_hooks;
if (pal::getenv(_X("DOTNET_STARTUP_HOOKS"), &startup_hooks))
{
if (!coreclr_properties.add(common_property::StartUpHooks, startup_hooks.c_str()))
const pal::char_t *config_startup_hooks;
if (coreclr_properties.try_get(common_property::StartUpHooks, &config_startup_hooks))
{
log_duplicate_property_error(coreclr_property_bag_t::common_property_to_string(common_property::StartUpHooks));
return StatusCode::LibHostDuplicateProperty;
// env startup hooks shoold have precedence over config startup hooks
// therefore append config_startup_hooks AFTER startup_hooks
startup_hooks.push_back(PATH_SEPARATOR);
startup_hooks.append(config_startup_hooks);
}

coreclr_properties.add(common_property::StartUpHooks, startup_hooks.c_str());
}

// Single-File Bundle Probe
Expand All @@ -303,7 +308,7 @@ int hostpolicy_context_t::initialize(hostpolicy_init_t &hostpolicy_init, const a

if (!coreclr_properties.add(common_property::BundleProbe, ptr_stream.str().c_str()))
{
log_duplicate_property_error(coreclr_property_bag_t::common_property_to_string(common_property::StartUpHooks));
log_duplicate_property_error(coreclr_property_bag_t::common_property_to_string(common_property::BundleProbe));
return StatusCode::LibHostDuplicateProperty;
}
}
Expand All @@ -318,7 +323,7 @@ int hostpolicy_context_t::initialize(hostpolicy_init_t &hostpolicy_init, const a

if (!coreclr_properties.add(common_property::PInvokeOverride, ptr_stream.str().c_str()))
{
log_duplicate_property_error(coreclr_property_bag_t::common_property_to_string(common_property::StartUpHooks));
log_duplicate_property_error(coreclr_property_bag_t::common_property_to_string(common_property::PInvokeOverride));
return StatusCode::LibHostDuplicateProperty;
}
}
Expand All @@ -327,7 +332,7 @@ int hostpolicy_context_t::initialize(hostpolicy_init_t &hostpolicy_init, const a
#if defined(HOSTPOLICY_EMBEDDED)
if (!coreclr_properties.add(common_property::HostPolicyEmbedded, _X("true")))
{
log_duplicate_property_error(coreclr_property_bag_t::common_property_to_string(common_property::StartUpHooks));
log_duplicate_property_error(coreclr_property_bag_t::common_property_to_string(common_property::HostPolicyEmbedded));
return StatusCode::LibHostDuplicateProperty;
}
#endif
Expand Down