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?