G
Guest
Hi,
I am using ‘CorBindToRuntimeEx’ To create a runtime host and execute an
assembly:
hr = CorBindToRuntimeEx(. . .)
hr = spICorRuntimeHost->CurrentDomain(&spUnk);
spIAppDomain = spUnk;
spIAssembly = spIAppDomain->Load_3(saRawPEImage);
.. . .
spIAssembly->EntryPoint->Invoke_3(vtMissing, saParameters);
When the assembly loads I get the following exception:
Could not instantiate ActiveX control . . . because the current thread is
not in a single threaded apartment.
I have verified that the executing IL code have the ‘[STAThread]’ attribute
for it’s entrypoint function.
When executing the assembly directly through the explorer every thing works
fine, it seems using ‘CorBindToRuntimeEx‘ in the manner just described is
causing the problem. . .
What am I doing wrong here?
What may cause this error?
I am using ‘CorBindToRuntimeEx’ To create a runtime host and execute an
assembly:
hr = CorBindToRuntimeEx(. . .)
hr = spICorRuntimeHost->CurrentDomain(&spUnk);
spIAppDomain = spUnk;
spIAssembly = spIAppDomain->Load_3(saRawPEImage);
.. . .
spIAssembly->EntryPoint->Invoke_3(vtMissing, saParameters);
When the assembly loads I get the following exception:
Could not instantiate ActiveX control . . . because the current thread is
not in a single threaded apartment.
I have verified that the executing IL code have the ‘[STAThread]’ attribute
for it’s entrypoint function.
When executing the assembly directly through the explorer every thing works
fine, it seems using ‘CorBindToRuntimeEx‘ in the manner just described is
causing the problem. . .
What am I doing wrong here?
What may cause this error?