该应用程序调用了一个已编组为不同线程的接口 [英] The application called an interface that was marshalled for a different thread

查看:130
本文介绍了该应用程序调用了一个已编组为不同线程的接口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发可以创建软件应用程序的软件产品.这基本上是在Visual Studio中完成的,并使用它提供的资源(例如Build).我们已经能够创建和构建应用程序了.最近,从VS 2005升级到了VS 2008.构建器代码中的组件之一是C ++.当构建被启动和取消时,它会给出异常为另一个线程编组的称为接口的应用程序".当我们尝试再次构建时.有一个IDispatch-> invoke方法,该方法传递了一个变体类型.对此有两个调用,

-通过VARIANT_FALSE告诉VS环境模型对话框将处于活动状态.
-通过VARIANT_TRUE在模型对话框关闭后完成.

这两个操作都是针对helpfile界面完成的.最有趣的部分是,此异常仅在第二次调用中发生,即在传递VARIANT_TRUE时发生.同样,这仅在取消后的第二个构建中发生.
我已经注意到,可以通过编组解决这些例外情况.但是我很困惑是否要封送IUnknown,Variant或帮助界面?
请提出建议.

I am working in a software product which can create software applications. This is basically done in Visual Studio and is using the resources provided by it ( eg Build). We have been able to create applications and build it. Recently there was an upgrade from VS 2005 to VS 2008. One of the components in builder code is in C++. When a build is initiated and cancelled, it is giving the exception "The application called an interface that was marshalled for a different thread" when we try to build again. There is an IDispatch ->invoke method which passes a variant type. There are two calls to this,

- Pass VARIANT_FALSE which tells the VS environment that a model dialog will be active.
- Pass VARIANT_TRUE which is done after the model dialog is closed.

Both this is done for helpfile interface. The funniest part is this exception occurs only in the second Invoke ie while passing VARIANT_TRUE. Also this happens only in the second build after a cancel.
I have noted that these exceptions can be solved by Marshalling. But i am confused whether to marshal the IUnknown, Variant  or the help interface ?
Please reply with suggestions.

推荐答案

您将需要提供有关要完成的目标的更详细的描述.一般而言,当您尝试在未正确编组到执行该方法的线程的COM接口上调用方法时,会引发该异常.您可能想在这里描述所涉及的体系结构.您要从外部应用程序自动化IDE吗?是否有托管代码?发生异常时,正在调用什么,从哪个线程调用?等等...

You will need to provide a more detailed desdription of what you are attempting to accomplish. Generally speaking, that exception is thrown when you attempt to invoke a method on a COM interface that was not properly marshalled to the thread executing the method.

You might want to describe the architecture involved here. Are you automating the IDE from an external application? Is there managed code involved? When the exception occurs, what is being called and from what thread? etc...


这篇关于该应用程序调用了一个已编组为不同线程的接口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆