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?

Signature
Nadav
http://www.ddevel.com
Willy Denoyette [MVP] - 08 Nov 2004 20:03 GMT
http://blogs.msdn.com/adam_nathan/archive/2003/07/18/56727.aspx
Willy.
> Hi,
>
[quoted text clipped - 21 lines]
> What am I doing wrong here?
> What may cause this error?