Symptoms
STA COM method invocation resulting in 0x8001010E RPC_E_WRONG_THREAD after installing .NET Framework 4.8.
Workarounds
Method 1: Environment variable
Set the following environment variable:COMPLUS_DisableCCWSupportIAgileObject=1
This method affects any environment that inherits this environment variable. This might be just a single console session, or it might affect the entire machine if you set the environment variable globally. The environment variable name is not case-sensitive.
Method 2: Registry
Using Registry Editor (regedit.exe), find either of the following subkeys:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework
HKEY_CURRENT_USER\SOFTWARE\Microsoft\.NETFramework
For 32-bit processes on x64 systems, use:
HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\.NETFramework
Then add the following:Value name: DisableCCWSupportIAgileObject Type: DWORD (32-bit) Value (also called REG_WORD) Value: 1
You can use the Windows REG.EXE tool to add this value from a command-line or scripting environment. For example:
reg add HKLM\SOFTWARE\Microsoft\.NETFramework /v DisableCCWSupportIAgileObject /t REG_DWORD /d 1
In this case, HKLM is used instead of HKEY_LOCAL_MACHINE. Use reg add /? to see help on this syntax. The registry value name is not case-sensitive.
More Information
More information about this .NET Framework 4.8 runtime change can be found here: https://learn.microsoft.com/en-us/dotnet/framework/migration-guide/runtime/4.7.2-4.8#net-interop-will-now-queryinterface-for-iagileobject-a-winrt-interface
Applies To
Applications running on .NET Framework 4.8 on supported versions of Windows.