Skip to content
Open
Changes from all commits
Commits
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
21 changes: 19 additions & 2 deletions lib/CoreCLR/boot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ HRESULT InitializeClrAndGetEntryPoint(

int result;
SetEnvironmentVariable(L"DOTNET_MULTILEVEL_LOOKUP", L"0");
SetEnvironmentVariable(L"COMPlus_legacyCorruptedStateExceptionsPolicy", L"1");
SetEnvironmentVariable(L"DOTNET_legacyCorruptedStateExceptionsPolicy", L"1");
SetEnvironmentVariable(L"COMPLUS_ForceENC", L"1");
SetEnvironmentVariable(L"DOTNET_ForceENC", L"1");

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

bool legacy_corrupted_state_exceptions_policy = false;
buffer.resize(0);
result = GetEnvironmentVariableW(L"DALAMUD_LEGACY_CORRUPTED_STATE_EXCEPTION", &buffer[0], 0);

if (result)
{
buffer.resize(result); // The first pass returns the required length
result = GetEnvironmentVariableW(L"DALAMUD_LEGACY_CORRUPTED_STATE_EXCEPTION", &buffer[0], result);
legacy_corrupted_state_exceptions_policy = buffer == L"1";
}
else
{
// Legacy fallback is true to preserve past behaviour
legacy_corrupted_state_exceptions_policy = true;
}

SetEnvironmentVariable(L"COMPlus_legacyCorruptedStateExceptionsPolicy", legacy_corrupted_state_exceptions_policy ? L"1" : L"0");
SetEnvironmentVariable(L"DOTNET_legacyCorruptedStateExceptionsPolicy", legacy_corrupted_state_exceptions_policy ? L"1" : L"0");

// =========================================================================== //

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