通过 COM 使用 .NET 的 UserControl 作为嵌入式控件
我正在将现有的 .NET 3.5 应用程序移植到 Eclipse 插件中。
我想要将我的自定义 UserControl 用 C# 编写,嵌入到 Eclipse 中; 我已成功将其导出为 COM 控件,并且它在 Eclipse Europa 中运行良好。
在 Ganymede 中,OLE 加载代码似乎已更改,而最初在 Europa 中有效的代码失败了。
具体错误是当 Ganymede 加载我的控件时,它查询 IOleObject,接收正确的接口,然后在其上调用 SetClientSite,这会导致我的对象丢失其引用,并被取消分配(Ganymede 将崩溃)。 完全相同的控件在 Visual C++ 设计器和 Europa 中都能完美运行。
除了明显的 .NET 属性和 UserControl 之外,是否还有我需要继承的特定类? 我需要实现的特定接口,或者 Europa/VC 和 Ganymede 之间的特定行为变化?
谢谢!
I'm porting an existing .NET 3.5 application into a plug-in for Eclipse.
I want to have my custom UserControl, written in C#, embedded within Eclipse; I've exported it successfully as a COM Control, and it works well in Eclipse Europa.
In Ganymede, it seems the OLE load code has changed, and what originally worked in Europa, fails.
The specific error is when Ganymede loads my control, it queries for IOleObject, receives the proper interface, and then calls SetClientSite on it, which causes my object to lose both its references, and become de-allocated (Ganymede will then crash).
The exact same control works flawlessly in both Visual C++ designer and in Europa.
Apart from the obvious .NET attributes and UserControl, is there any specific class I need to inherit from? Specific interfaces I need to implement, or specific behavior change between Europa/VC and Ganymede?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果有人仍然遇到此问题,请在 Connect 上报告该问题。 报告完成后,请在此处发布错误报告的 URL,以便阅读这篇文章的人可以对其进行投票。
如果这仍然是一个错误,那么最好通过 .NET 4.0 或至少 SP1 的 RTM 来修复它。
If anyone is still having this problem, then please report it on Connect. When done reporting, please post the URL of the bug report here, so people who read this post can vote on it.
If this is still a bug, it would be nice to get it fixed by RTM of .NET 4.0, or at least SP1.
我在非 .NET 环境中托管 .NET 控件时遇到过类似的问题。 我的一些用户控件向 COM 公开的方式存在问题。
按照本网站上的示例解决了我的问题,也许它也会对您有所帮助!
链接
I've come across similar problems with hosting .NET controls in non .NET environments. There have been problems with how some of my user controls have exposed to COM.
Following the example on this site solved my problem, perhaps it will help you too!
Link