[英]Howto troubleshoot vb6 dll 800a01ad error in c# application
I have a dll that I created from a VB6 project that I am now using in ac# project. 我有一个从我现在在ac#项目中使用的VB6项目创建的dll。 This has worked before but now when I try to return to the c# project to fix a bug, the program get a COMException stating roughly translated: 这以前曾奏效,但现在当我尝试返回c#项目修复错误时,该程序将获得COMException声明,大致翻译为:
Could not create an instance of COM-component with CLSID {085E3494-9F78-47D5-B0E6-FA460FD3CBED} from IClassFactory because of the following error: 800a01ad. 由于以下错误,无法从IClassFactory创建具有CLSID {085E3494-9F78-47D5-B0E6-FA460FD3CBED}的COM组件实例:800a01ad。
So I try to create a new empty c# project with only one line in the main function: 因此,我尝试在主函数中仅创建一行以创建一个新的空c#项目:
OurNamespace.OurClass foo = new OurNamespace.OurClass();
Which fails with the same error. 失败并显示相同的错误。
I have registered the dll but that did not change the outcome of the problem. 我已经注册了dll,但是并没有改变问题的结果。
The problem only occurs on the machine I am currently at, still I'm interested to understand the problem so that I know how to fix it if it occurs on a customers computer. 该问题仅发生在我当前所在的计算机上,但我仍然想了解该问题,以便我知道如果在客户计算机上发生此问题,该如何解决。
This translates to VB6 runtime error 429, "ActiveX can't create object". 这将转换为VB6运行时错误429,“ ActiveX无法创建对象”。 It is not your C# code that is failing, it is the VB6 code that has a problem. 失败的原因不是您的C#代码,而是有问题的VB6代码。 You can only get somewhere by debugging the VB6 code. 您只能通过调试VB6代码到达某个地方。 You'll need the VB6 IDE, load the library project, set your C# program as the start program and set a breakpoint on the Class_Initialize subroutine of the class you are trying to create in your C# code. 您将需要VB6 IDE,加载库项目,将C#程序设置为启动程序,并在要在C#代码中尝试创建的类的Class_Initialize子例程上设置一个断点。
Working from the assumption you don't have the tools anymore, error 429 has a lot of potential causes. 从不再使用工具的假设出发,错误429有很多潜在原因。 The most common one is a registration problem, solved by running Regsvr32.exe on a DLL that the VB6 code uses. 最常见的一个是注册问题,可以通过在VB6代码使用的DLL上运行Regsvr32.exe来解决。
请尝试按照此kb文章中的步骤操作,以查看是否有帮助http://support.microsoft.com/kb/194801
Compile your VB6 DLL with Binary Compatibility set. 使用Binary Compatibility集编译VB6 DLL。 Otherwise the GUID of your VB6 DLL keeps changing every time you compile. 否则,每次编译时,VB6 DLL的GUID都会不断更改。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.