Hi,
I am using ‘CorBindToRun timeEx’ To create a runtime host and execute an
assembly:
hr = CorBindToRuntim eEx(. . .)
hr = spICorRuntimeHo st->CurrentDomain( &spUnk);
spIAppDomain = spUnk;
spIAssembly = spIAppDomain->Load_3(saRawPE Image);
.. . .
spIAssembly->EntryPoint->Invoke_3(vtMis sing, 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 ‘CorBindToRun timeEx‘ in the manner just described is
causing the problem. . .
What am I doing wrong here?
What may cause this error?
--
Nadav
http://www.ddevel.com