本文介绍了VB6的无与伦比C#RCW错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图通过使用通过COM互操作公开的C#编写的.NET

组件来扩展旧版VB6应用程序。一切似乎都很顺利(VB应用程序创建了.NET组件而不是

遗留VB6组件并成功调用了一些方法)直到我点击

snag。


对于VB6应用程序调用的一种方法,方法

需要2个参数(字符串值)和一个自定义接口。根据

处理,此自定义界面可能是有效对象,或者可能是

Nothing。当在实现

此接口的旧版VB6对象上调用此方法时,不会遇到任何错误。在我的

..NET组件上调用此方法时,我收到以下错误:

对象引用未设置为对象的实例(0x8000403)。 br />
我已经确定错误是由于自定义接口参数(我通过创建一个
$来确保它在VB6调试器中被捕获时可以避免这个问题b $ b实现接口的对象实例。


我的问题是,是什么导致生成的运行时可调用包装器被C#生成
失败自定义界面

为Nothing时出现0x8000403错误的请求并且,更重要的是,无论如何我可以禁用此错误

或解决问题而无需更改VB6传统

应用程序?


我希望这些信息足够详细,以便读者能够确定这是一个明显的错误是否有明显的解决方案(只是

一个我我不知道。但是,如果不是,需要一个例子,

请告诉我,我会生成一个。感谢任何帮助。


谢谢,Tyler

I am attempting to extend a legacy VB6 application by making it use a .NET
component written in C# exposed through COM interop. Everything appeared to
be going well (VB application creates the .NET component instead of the
legacy VB6 component and invokes some methods successfully) until I hit a
snag.

For one method that is being invoked by the VB6 application, the method
takes 2 parameters (string values) and a custom interface. Depending on
processing, this custom interface may be a valid object, or may be
"Nothing". When this method is invoked on a legacy VB6 object implementing
this interface, no error is experienced. When this method is invoked on my
..NET component, I get the following error:
Object reference is not set to an instance of an object (0x8000403).
I have determined that the error is due to the custom interface parameter (I
can avoid the problem when it is caught in the VB6 debugger by creating an
instance of an object that implements the interface).

My question is, what causes the runtime callable wrapper that is generated
by C# to fail the request with the 0x8000403 error when the custom interface
is "Nothing" and, more importantly, is there anyway I can disable this error
or work-around the problem without having to change the VB6 legacy
application?

I hope this information is sufficiently detailed to allow a reader to
determine whether this is an obvious error with an obvious solution (just
one that I don''t know). However, if it is not and an example is required,
please let me know and I will generate one. Any assistance is appreciated.

Thanks, Tyler

推荐答案








这篇关于VB6的无与伦比C#RCW错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-22 17:09