Skip to content

Commit 958d1df

Browse files
committed
make legacy corrupted state exceptions policy configurable
1 parent 1d939e2 commit 958d1df

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

lib/CoreCLR/boot.cpp

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,6 @@ HRESULT InitializeClrAndGetEntryPoint(
4141

4242
int result;
4343
SetEnvironmentVariable(L"DOTNET_MULTILEVEL_LOOKUP", L"0");
44-
SetEnvironmentVariable(L"COMPlus_legacyCorruptedStateExceptionsPolicy", L"1");
45-
SetEnvironmentVariable(L"DOTNET_legacyCorruptedStateExceptionsPolicy", L"1");
4644
SetEnvironmentVariable(L"COMPLUS_ForceENC", L"1");
4745
SetEnvironmentVariable(L"DOTNET_ForceENC", L"1");
4846

@@ -83,6 +81,25 @@ HRESULT InitializeClrAndGetEntryPoint(
8381
dotnet_path = _wcsdup(fs_app_data.append("XIVLauncher").append("runtime").c_str());
8482
}
8583

84+
bool legacy_corrupted_state_exceptions_policy = false;
85+
buffer.resize(0);
86+
result = GetEnvironmentVariableW(L"DALAMUD_LEGACY_CORRUPTED_STATE_EXCEPTION", &buffer[0], 0);
87+
88+
if (result)
89+
{
90+
buffer.resize(result); // The first pass returns the required length
91+
result = GetEnvironmentVariableW(L"DALAMUD_LEGACY_CORRUPTED_STATE_EXCEPTION", &buffer[0], result);
92+
legacy_corrupted_state_exceptions_policy = buffer == L"1";
93+
}
94+
else
95+
{
96+
// Legacy fallback is true to preserve past behaviour
97+
legacy_corrupted_state_exceptions_policy = true;
98+
}
99+
100+
SetEnvironmentVariable(L"COMPlus_legacyCorruptedStateExceptionsPolicy", legacy_corrupted_state_exceptions_policy ? L"1" : L"0");
101+
SetEnvironmentVariable(L"DOTNET_legacyCorruptedStateExceptionsPolicy", legacy_corrupted_state_exceptions_policy ? L"1" : L"0");
102+
86103
// =========================================================================== //
87104

88105
logging::I("with dotnet_path: {}", dotnet_path);

0 commit comments

Comments
 (0)