E_NoInterface Error
-
Hi All, I upgraded a project from VB to VB.net ( ActivexDll). After converting while debugging I am getting an error "E_nointerface". Can any one please tell me why do we get this error? Through goggling I found some results telling it may be due to threading conflicts. If so please tell me how to set threading in VB.Net.( In VB I found that threading mode is set to "Apartment" in project properties similarly how do we do it in Visual studio 2003 )
-
Hi All, I upgraded a project from VB to VB.net ( ActivexDll). After converting while debugging I am getting an error "E_nointerface". Can any one please tell me why do we get this error? Through goggling I found some results telling it may be due to threading conflicts. If so please tell me how to set threading in VB.Net.( In VB I found that threading mode is set to "Apartment" in project properties similarly how do we do it in Visual studio 2003 )
Well, I think you'd have a hard time converting this project using the Conversion Wizard. Something like this is usually going to be rewritten by hand. You can check out this article[^] about using the
STAThread
andMTAThread
attributes. And, if you're starting a new thread, you can set the apartment state by setting the Thread object's ApartmentState property before you Start the thread.A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007, 2008 -
Well, I think you'd have a hard time converting this project using the Conversion Wizard. Something like this is usually going to be rewritten by hand. You can check out this article[^] about using the
STAThread
andMTAThread
attributes. And, if you're starting a new thread, you can set the apartment state by setting the Thread object's ApartmentState property before you Start the thread.A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007, 2008Thanks Dave for your reply. I tried the following 1)
<STAThread()> _
and<MTAThread()> _
before the class is intialized. Is it the correct place ? 2)System.Threading.Thread.CurrentThread.ApartmentState = Threading.ApartmentState.STA But still no luck. I verified after changing threading model in Registry. It is getting reflected and the Guid is matching with my code. Any more suggestion please. -
Thanks Dave for your reply. I tried the following 1)
<STAThread()> _
and<MTAThread()> _
before the class is intialized. Is it the correct place ? 2)System.Threading.Thread.CurrentThread.ApartmentState = Threading.ApartmentState.STA But still no luck. I verified after changing threading model in Registry. It is getting reflected and the Guid is matching with my code. Any more suggestion please.BINO VARGHESE wrote:
)<STAThread()> _ and <mtathread()> _ before the class is intialized. Is it the correct place ?
From your description, and not being able to see any code, I seriously doubt it. Those attributes don't go on classes.
BINO VARGHESE wrote:
2)System.Threading.Thread.CurrentThread.ApartmentState = Threading.ApartmentState.STA
That won't work as you can't change the apartment state after a thread is started. Somehow, I don't even think your starting a new thread. There are no other suggestions. Without knowing anything about your code, what it looks like, what this component is doing, there's really nothing I can say.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007, 2008