Click here to Skip to main content
15,867,704 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
O.k, this problem has been very evasive so far so I'm hoping someone here could help me.

I have the following code to late bind to a VB6 DLL (via a wrapper created by the Type Library Importer)
* Note the following code has been stripped of all error handling etc. for the purpose of this post.

FileInfo _library = new FileInfo(filePath);
Assembly _assembly = Assembly.LoadFile(_library.FullName);
var tn = _assembly.GetTypes().Where(p=>p.FullName.EndsWith("CommsClass")).SingleOrDefault();
string typeName = tn.ToString();
Type _classType = _assembly.GetType(typeName);
object _classObject = Activator.CreateInstance(_classType);


On some machines, and typically as the "programmers curse" would have it, not on MY machine, this code crashes on the last line with the following exception:
Error creating an instance of the object type: wr_TCPIP_ASTM.TCPIP_ASTM_CommsClass Creating an instance of the COM component with CLSID {27CC4E03-D86D-40B5-96D4-F7EA5B148A0D} from the IClassFactory failed due to the following error: 800a0153.


Like I said, I saw this error for the first time on a production system, tried logging in as Administrator, made no difference. All windows updates, frameworks and service packs are current.

Both the wrapper DLL and the original DLL are located on the file system where they belong. I might mention that the VB6 DLL references a system DLL, in this case it's the WINSCK.OCX, but in some other DLL's that give the same problem I reference MSCOMM32.OCX.

Any ideas at all?
Posted
Updated 21-Sep-10 22:01pm
v2
Comments
E.F. Nijboer 22-Sep-10 4:15am    
Did you register the COM component(s) properly?
MatthysDT 22-Sep-10 4:37am    
All DLL's are registered using regsvr32.exe

do you know which dll/ocx/exe implements the object wr_TCPIP_ASTM.TCPIP_ASTM_CommsClass (27CC4E03-D86D-40B5-96D4-F7EA5B148A0D)?

You can find out using regedit - under classes root
HKEY_CLASSES_ROOT find wr_TCPIP_ASTM.TCPIP_ASTM_CommsClass
under wr_TCPIP_ASTM.TCPIP_ASTM_CommsClass should be CLSID
Copy the contents of CLSID then find it as a key
Once you have found the key it will give you the path to the dll/ocx/exe that your software is failing to load in the production environment


The above process will check that the com object is registered, also check the there is something located in the registered path

If all this is correct then I think you must have a security issue in the production environment.
 
Share this answer
 
Comments
MatthysDT 22-Sep-10 4:53am    
Thank you ARopo, following your instructions, it basically points to my VB6 DLL, which works fine on my system.
Another point worth mentioning, this very same DLL referenced by our old software (not .Net) on the very same PC, works fine. So I'm pretty sure the DLL doesn't crash internally.
ARopo 22-Sep-10 6:36am    
Does the guid 27CC4E03-D86D-40B5-96D4-F7EA5B148A0D match the key in the registry?
Registering the components in a COM+ application in Component Service fixed this.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900