HighTechTalks DotNet Forums  

late binding COM process startup problem - COM exception 80080005

Dotnet Framework (Interop) microsoft.public.dotnet.framework.interop


Discuss late binding COM process startup problem - COM exception 80080005 in the Dotnet Framework (Interop) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
tb2000
 
Posts: n/a

Default late binding COM process startup problem - COM exception 80080005 - 09-21-2007 , 11:00 AM






I ran into this problem when trying to late bind a COM based application. (I
have an API description but no TLB to generate an RCW), so I had to remodel
the interfaces.
The COM Server resides as LocalServer (EXE). My app is a .NET console app.

I am using the Activator.CreateInstance(Type).

Now, if the COM code is running (before I start my c# based app) I can
access the object, all well. It appreas the managed code is actually loading
the COM server, I can see the process appearing.
Now (a quick hack) I wrote a workaround, checking if I already have that
process and (if not) I do a Process.Start(filepath) preload with a subsequent
Activator.CreateInstance().

Amazingly I get the same COM exception if I do this "undelayed". If I wait
until the process is alive all is ok.

I found several similar error quests searching around, many from the ASP
worlds, but no solution (yet). Maybe some people can benefit from a fixe,
even if my quick hack works for me and now...

Here's the code:

Thanx ahead!
tb

try
{ //Check for executable and start if process is not running
if (progID.ProcessName.Length > 0)
{
Process[] p =
Process.GetProcessesByName(progID.ProcessName);
if (p.Length == 0)
{
Process.Start(progID.COMpath);
int n = 10;
while (p.Length == 0 && --n > 0)
{
p =
Process.GetProcessesByName(progID.ProcessName);
System.Threading.Thread.Sleep(500);
}
}
}
}
catch (Exception e)
{
Debug.WriteLine(e.Message);
}

try
{
comObject = Activator.CreateInstance(comType);
}

Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.