在.NET中线程/编组COM的问题(?) [英] Problem with threading/marshalling COM within .NET (?)

查看:62
本文介绍了在.NET中线程/编组COM的问题(?)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,


首先,这是我正在创建的.NET 1.1组件。


摘要
-----------------------


我正在创建的这个组件是,为了所有意图和目的,一个

文档解析器(我实际上是将SOAP文档反序列化为一个

对象并解析出这些字段,但这是公平的对此无关紧要。

问题。


此组件由VB 6.0管理器实例化。对象,并且是通过引用C ++ COM数据对象传递的
,在解析器中的一个单独的线程

中,我填充了一堆子对象。 />
根据需要实例化。这个C ++ COM对象基本上是一个非常好的b $ b健壮的数据对象,其中包含了记录

节点的单个子节点。


I应该提一下,我不能改变

接收参数的方法的签名,因为界面已被定义并锁定

已经下降了。


当我完成所有解析后,我调用了我的回调方法(因为我之前说过
,解析发生在一个单独的线程上),然后

通知管理器解析完成,并且它可以保存数据对象的内容(它已经有了句柄)。


我在通知经理对象之前检查了子线程的活动状态,并说它已经不再存在了。我也在

正确的线程(我检查了我分配线程的名称)当我告诉管理员解析完成时。最后,我明确设置

我的主线程和子线程的公寓状态为STA

(通过在主线程中修饰相应的方法)。


问题

---------------------------


我的问题是我在数据对象中得到一个错误(之后它已经被传回VB管理器,并且我的解析已经完成了)

与它有关,无法写入系统安全日志。

**这似乎不是应用程序的错,而是,

我的代码'的错,因为如果我同步运行我的所有代码,数据

对象能够保存一切正常,并且可以写入

系统安全日志。**

我将数据对象传递给线程'

构造函数中的子线程(通过引用) ,并且,在那个单独的线程中,它能够访问和操纵al l

添加/删除/修改威胁所需的属性和方法。


问题

------- -------------


我的问题是,我是否需要做一些特别的事情(例如一些深奥的

编组命令)以确保COM数据对象不会因为某些原因而在孩子内部被损坏或变得无效

线程?通常对COM对象做什么(包装在RCW中)

将它们传递到单独的线程之前?我完全不想要b $ b缺少一些东西吗?


你们所能提出的任何建议都会非常有帮助,因为这几乎是
唯一的问题就是抱着我吧。我可以发布代码的某些

子部分,但它非常密集,所以我想首先尝试一下

的问题描述。


理想情况下,有人可以告诉我到底我做错了什么,因为他们之前遇到过这个问题。如果我已经完成了非常愚蠢的事情,请随意嘲笑我!


提前感谢您提供任何帮助。


问候,


布莱斯

Hello,

First of all, this is a .NET 1.1 component I''m creating.

SUMMARY
-----------------------

This component that I''m creating is, for all intents and purposes, a
document parser (I''m actually deserializing a SOAP document into an
object and parsing out the fields, but that''s fairly immaterial to this
issue).

This component is instantiated by a VB 6.0 "manager" object, and is
passed by reference a C++ COM data object which, in a separate thread
within the parser, I populate with a bunch of child objects that are
instantiated as necessary. This C++ COM object is basically a very
robust data object, which contains individual children which are record
nodes.

I should mention that I can''t change the signature of the method that
receives the parameters, as the interface has been defined and locked
down already.

When I''m done with all my parsing, I invoke my callback method (as I
stated before, the parsing occurs on a separate thread), which then
notifies the manager that the parsing is complete, and that it can save
the contents of the data object (which it already has a handle to).

I''ve checked the active state of the child thread prior to notifying
the manager object, and it says it''s no longer alive. I''m also in the
correct thread (I checked the names I assigned the threads) when I
notify the manager that parsing is complete. Finally, I explicitly set
both my main thread and child threads to have an apartment state of STA
(by decorating the appropriate methods in the main thread).

PROBLEM
---------------------------

My problem is that I get an error within the data object (after it has
been passed back into the VB manager, and my parsing has completed)
having to do with it being unable to write to the system security log.
**This does not appear to be the fault of the application, but rather,
my code''s fault, because if I run all my code synchronously, the data
object is able to save everything fine, and is able to write to the
system security log.**

I''m passing in the data object to my child thread within the thread''s
constructor (by reference), and, within that separate thread, it''s able
to access and manipulate all the properties and methods necessary to
add/delete/modify threats.

QUESTION
--------------------

My question is, do I need to do something special (e.g. some esoteric
marshalling command) to ensure that the COM data object is not going to
get corrupted or become invalid for some reason within the child
thread? What typically is done to COM objects (wrapped in the RCW)
prior to them being passed into separate threads? Am I completely
missing something?

Anything you guys can suggest would be extremely helpful, as this is
pretty much the only issue holding me up now. I could post certain
sub-sections of the code, but it''s pretty dense, so I wanted to try a
description of the issue first.

Ideally, someone can tell me exactly what I''m doing wrong because
they''ve experienced the problem before. Feel free to mock me if I''ve
done something extraordinarily stupid, as well!

Thanks in advance for any help you can give.

Regards,

Bryce

推荐答案

布莱斯,


我很担心你将COM对象引用传递给

另一个线程(可能还有另一个公寓)。


如何编组COM接口指针?你不能通过线程传递

COM接口指针(取决于公寓)。如果你在这里不小心,那么
会引起问题,至少可以这么说。你有

要知道线程所在的公寓,以及组件要求的公寓




另外,回调方法,它们也是COM接口指针吗?

这些必须正确编组到进行回调的线程。


你还说:


最后,我明确地设置我的主线程和子线程都有一个

公寓状态的STA(通过装饰相应的方法) main

线程)。




应用程序的主线程设置公寓状态的属性(如STAThread)仅适用于

应用程序的入口点。从STAThread的文档:


将此属性应用于入口点方法(C#中的Main()方法和

Visual Basic)。它对其他方法没有影响。要设置公寓状态

您在代码中启动的线程,请在启动线程之前使用Thread.SetApartmentState方法




查看问题陈述,看来你必须正确编组

接口指针。你需要在全局

界面表上注册并传递cookie,或者你可以将marhsal发送到一个流然后

解组它。


我对.NET代码的详细信息有点模糊,而且b / b
多少是VB / C ++代码。毋庸置疑,这些机制在所有这些机制中都是相同的。它归结为你必须正确地跨越公寓边界编组COM

接口指针,它看起来像你可能没有定义这些边界或传递它们的
正确。


希望这会有所帮助。

-

- Nicholas Paldino [.NET / C#MVP]

- mv*@spam.guard.caspershouse.com


布莱斯卡尔霍恩 < BC ****** @ gmail.com>在消息中写道

news:11 ********************** @ g47g2000cwa.googlegr oups.com ...
Bryce,

I''m a little concerned about you passing the COM object reference to
another thread (and possibly, another apartment).

How are you marshaling the COM interface pointer? You can''t just pass
COM interface pointers across threads (depending on the apartments). It
will cause problems if you are not careful here, to say the least. You have
to be aware of the apartment that the thread is in, as well as the apartment
that the component demands.

Also, the callback methods, are they COM interface pointers as well?
These have to be marshaled correctly to the thread making the callbacks.

You also state:

Finally, I explicitly set both my main thread and child threads to have an
apartment state of STA (by decorating the appropriate methods in the main
thread).

The attributes to set the apartment state for the main thread of an
application (like STAThread) only work for the entry point of the
application. From the documentation of STAThread:

Apply this attribute to the entry point method (the Main() method in C# and
Visual Basic). It has no effect on other methods. To set the apartment state
of threads you start in your code, use the Thread.SetApartmentState method
before starting the thread.

Looking at the problem statement, it appears that you have to marshal
the interface pointer correctly. You need to register on the global
interface table and pass the cookie, or you can marhsal to a stream and then
unmarshal it.

I''m a little vague on the details on how much of this is .NET code, and
how much is VB/C++ code. Needless to say, the mechanism will be the same in
all of them. What it comes down to is that you have to marshal COM
interface pointers across apartment boundaries correctly, and it looks like
you might not be defining those boundaries, or passing them correctly.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Bryce Calhoun" <bc******@gmail.com> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com...
你好,

首先,这是我正在创建的.NET 1.1组件。

概述
------ -----------------

为了所有意图和目的,我正在创建的这个组件是一个
文档解析器(我实际上是将SOAP文档反序列化为
对象并解析出这些字段,但这对于这个问题来说相当无关紧要。

此组件由实例化一个VB 6.0经理对象,并通过引用传递一个C ++ COM数据对象,在解析器中的一个单独的线程中,我填充了一堆必要时实例化的子对象。这个C ++ COM对象基本上是一个非常强大的数据对象,它包含作为记录节点的个别孩子。

我应该提到我不能改变签名接收参数的方法,因为已经定义并锁定了接口。

当我完成所有解析后,我调用了我的回调方法(正如我先前所述,解析发生在一个单独的线程上),然后通知管理器解析完成,并且它可以保存数据对象的内容(它已经掌握了。)

我在通知经理对象之前检查了子线程的活动状态,它说它已经不再存在了。当我通知管理员解析完成时,我也在
正确的线程(我检查了我分配线程的名称)。最后,我明确地将我的主线程和子线程设置为具有STA的公寓状态
(通过在主线程中修饰相应的方法)。

问题
---------------------------

我的问题是我在数据对象中收到错误(在它被传递回VB管理器之后,我的解析已经完成了。
与它无法写入系统安全日志有关。

**这似乎不是应用程序的错,而是我的代码的错,因为如果我同步运行我的所有代码,数据对象能够保存一切正常,并且能够写入
系统安全日志。**

我正在将数据对象传递给线程'
构造函数中的子线程(通过参考),并且,在该单独的线程中,它能够访问和操作
添加/删除/修改t所需的所有属性和方法问题。

问题
--------------------

我的问题是,我需要吗?做一些特别的事(例如一些深奥的编组命令),以确保COM数据对象不会因为某些原因在子线程中被破坏或变为无效?在将它们传递到单独的线程之前,通常对COM对象(包装在RCW中)做了什么?我是否完全错过了什么?

你们所能提出的任何建议都会非常有帮助,因为这几乎是我现在唯一的问题。我可以发布代码的某些子部分,但它非常密集,所以我想先尝试一下这个问题的描述。

理想情况下,某人可以告诉我到底我做错了什么,因为他们之前已经遇到过这个问题。如果我已经做了非常愚蠢的事情,请随意嘲笑我!

提前感谢您提供任何帮助。

此致,

布莱斯
Hello,

First of all, this is a .NET 1.1 component I''m creating.

SUMMARY
-----------------------

This component that I''m creating is, for all intents and purposes, a
document parser (I''m actually deserializing a SOAP document into an
object and parsing out the fields, but that''s fairly immaterial to this
issue).

This component is instantiated by a VB 6.0 "manager" object, and is
passed by reference a C++ COM data object which, in a separate thread
within the parser, I populate with a bunch of child objects that are
instantiated as necessary. This C++ COM object is basically a very
robust data object, which contains individual children which are record
nodes.

I should mention that I can''t change the signature of the method that
receives the parameters, as the interface has been defined and locked
down already.

When I''m done with all my parsing, I invoke my callback method (as I
stated before, the parsing occurs on a separate thread), which then
notifies the manager that the parsing is complete, and that it can save
the contents of the data object (which it already has a handle to).

I''ve checked the active state of the child thread prior to notifying
the manager object, and it says it''s no longer alive. I''m also in the
correct thread (I checked the names I assigned the threads) when I
notify the manager that parsing is complete. Finally, I explicitly set
both my main thread and child threads to have an apartment state of STA
(by decorating the appropriate methods in the main thread).

PROBLEM
---------------------------

My problem is that I get an error within the data object (after it has
been passed back into the VB manager, and my parsing has completed)
having to do with it being unable to write to the system security log.
**This does not appear to be the fault of the application, but rather,
my code''s fault, because if I run all my code synchronously, the data
object is able to save everything fine, and is able to write to the
system security log.**

I''m passing in the data object to my child thread within the thread''s
constructor (by reference), and, within that separate thread, it''s able
to access and manipulate all the properties and methods necessary to
add/delete/modify threats.

QUESTION
--------------------

My question is, do I need to do something special (e.g. some esoteric
marshalling command) to ensure that the COM data object is not going to
get corrupted or become invalid for some reason within the child
thread? What typically is done to COM objects (wrapped in the RCW)
prior to them being passed into separate threads? Am I completely
missing something?

Anything you guys can suggest would be extremely helpful, as this is
pretty much the only issue holding me up now. I could post certain
sub-sections of the code, but it''s pretty dense, so I wanted to try a
description of the issue first.

Ideally, someone can tell me exactly what I''m doing wrong because
they''ve experienced the problem before. Feel free to mock me if I''ve
done something extraordinarily stupid, as well!

Thanks in advance for any help you can give.

Regards,

Bryce



Nicolas,


让我看看我是否明白你的意思''说'


1.对于我将在我的子线程中使用的任何COM对象,我需要在线程中明确封送它的
边界。正确吗?


2.如果是这种情况,那么我需要做一个DLLImport

CoMarshalInterThreadInterfaceInStream和

CoGetInterfaceAndReleaseStream和坚持引用COM对象

在我的参数类中,我用它作为将参数传递给我的子线程的
的方法。正确吗?


3.我在第二个帖子中创建的任何COM对象然后添加到我的

数据对象(可能已被编组),我这样做不需要

明确地编组,因为容器对象已被编组

已经?


4.当我调用我的时候来自子线程的回调,数据对象

和错误处理程序对象,它们已被编组并传入

- 我是否需要将它们重新编组回到主线程,或者我可以使用我最初引用的对象吗?


5.最后,是否更好/更容易使用GIT要整理这些

对象?如果是这样,你有什么具体的建议我将如何使用它?
应该如何使用它?也就是说,有代码样本吗?至于我理解,我需要做一些事情,比如创建一个接口和一个

包装类来实现它,而且我不太清楚我是怎么做的会这样做。

所以。


6.没有.NET负责整理原生.NET对象

个线程自动?为什么它不处理编组COM对象

(在我的情况下,已经包装在RCW中)?只需一个简单的

解释就足够了,我有点好奇。


Nicholas,非常感谢您的建议和帮助。

我非常感谢您提供的任何进一步帮助。


亲切的问候,


布莱斯

Nicolas,

Let me see if I understand what you''re saying:

1. For any COM object that I will be using within my child thread, I
need to explicitly marshal it across the thread boundary. Correct?

2. If this is the case, then I need to do a DLLImport of
CoMarshalInterThreadInterfaceInStream and
CoGetInterfaceAndReleaseStream and stick references to the COM objects
in my parameters class that I use as a means of passing parameters to
my child thread. Correct?

3. Any COM objects I create in my second thread and then add to my
Data Object (which would have been marshalled), I do not need to
explictly marshal, as the container object would have been marshalled
already?

4. When I invoke my callback from the child thread, the Data Object
and Error Handler objects which would have been marshaled and passed in
-- do I need to re-marshal them back to the primary thread, or can I
use the objects that I initially had a reference to?

5. Finally, would it be better/easier to use the GIT to marshal these
objects? If so, do you have some specific recommendation as to how I
should use it? That is, are there any code samples? As far as I
understand, I would need to do something like create an interface and a
wrapper class to implement it, and it''s not very clear how I would do
so.

6. Doesn''t .NET take care of marshalling native .NET objects across
threads automatically? Why doesn''t it handle marshalling COM objects
(which, in my case, have already been wrapped in a RCW)? Just a simple
explanation would suffice, I''m mildly curious.

Nicholas, thank you very much for your suggestions and help thus far.
I truly appreciate any further help you can provide.

Kind regards,

Bryce


你不必自己编组接口指针,CLR通过调用ole32!CoMarshalInterface每当ITF指针时为你完成这个


更改背景。


Willy。


" Nicholas Paldino [.NET / C# MVP] QUOT; < mv*@spam.guard.caspershouse.com>写在

消息新闻:ei ************* @ TK2MSFTNGP14.phx.gbl ...

|布莱斯,

|

|我有点担心你将COM对象引用传递给

|另一个线程(可能还有另一个公寓)。

|

|你是如何编组COM接口指针的?你不能只通过

|跨线程的COM接口指针(取决于公寓)。它

|如果你在这里不小心会导致问题,至少可以说。你



|要知道线程所在的公寓,以及

公寓

|组件要求。

|

|另外,回调方法也是COM接口指针吗?

|这些必须正确地编组到进行回调的线程。

|

|你还说:

|

|最后,我明确地将我的主线程和子线程都设置为

| STA的公寓状态(通过装饰主要的方法在

|线程中)。

|

|用于设置

|主线程的单元状态的属性应用程序(如STAThread)仅适用于

|的入口点应用。从STAThread的文档:

|

|将此属性应用于入口点方法(C#

中的Main()方法和

| Visual Basic)。它对其他方法没有影响。设置公寓



|你在代码中开始的线程,使用Thread.SetApartmentState方法

|在开始之前。

|

|看一下问题陈述,看来你必须编组

|接口指针正确。您需要在全球注册

|接口表并传递cookie,或者你可以marhsal到一个流和

然后

| unmarshal it。

|

|我对.NET代码的详细信息有点模糊,并且

| VB / C ++代码多少钱。不用说,机制将是相同的



|中他们都是。它归结为你必须编组COM

|正确地跨越公寓边界的界面指针,它看起来好像

|你可能没有定义这些边界,也没有正确地传递它们。

|

|希望这会有所帮助。

|

|

| -

| - Nicholas Paldino [.NET / C#MVP]

| - mv*@spam.guard.caspershouse.com

|

| 布莱斯卡尔霍恩 < BC ****** @ gmail.com>在消息中写道

|新闻:11 ********************** @ g47g2000cwa.googlegr oups.com ...

| >你好,

| >

| >首先,这是我正在创建的.NET 1.1组件。

| >

| >摘要

| > -----------------------

| >

| >对于所有意图和目的,我正在创建的这个组件是一个

| >文档解析器(我实际上是将SOAP文档反序列化为一个

|>对象并解析出这些字段,但这对此非常重要

| >问题)。

| >

| >该组件由VB 6.0管理器实例化。对象,并且是

| >通过引用传递一个C ++ COM数据对象,它在一个单独的线程中

| >在解析器中,我填充了一堆子对象,这些对象是
| >必要时进行实例化。这个C ++ COM对象基本上是一个非常好的
| >强大的数据对象,其中包含记录的单个子项

| >节点。

| >

| >我应该提一下,我不能改变

|的方法的签名>接收参数,因为界面已被定义并锁定

| >已经下来了。

| >

| >当我完成所有的解析后,我调用了我的回调方法(因为我之前说过的是
|>,解析发生在一个单独的线程上),然后是

| >通知经理解析完成,并且它可以保存

| >数据对象的内容(它已经有句柄)。

| >

| >我在通知之前检查了子线程的活动状态

| >经理对象,它说它不再活着。我也在

| >正确的线程(我检查了我分配线程的名称)当我

| >通知经理解析完成。最后,我明确设置了

| >我的主线程和子线程都有一个公寓状态STA

| > (通过在主线程中修饰相应的方法)。

| >

| >问题

| > ---------------------------

| >

| >我的问题是我在数据对象中得到一个错误(之后它已经被传回VB管理器,并且我的解析已经完成了)

| >这与它无法写入系统安全日志有关。

| >

| >

| > **这似乎不是应用程序的错,而是

| >我的代码有问题,因为如果我同步运行我的所有代码,数据

| >对象能够保存一切正常,并且可以写入

| >系统安全日志。**

| >

| >我将数据对象传递给线程'

|中的子线程>构造函数(通过引用),并且,在该单独的线程中,它能够

| >访问和操作

|所需的所有属性和方法>添加/删除/修改威胁。

| >

| >问题

| > --------------------

| >

| >我的问题是,我是否需要做一些特殊的事情(例如一些深奥的

|>编组命令)以确保COM数据对象不会出现

| >由于某种原因在孩子内部被破坏或变得无效

| >线?通常对COM对象做什么(包装在RCW中)

| >在它们被传递到单独的线程之前?我完全是

| >遗失了什么?

| >

| >你们建议的任何东西都会非常有用,因为这是

| >几乎是现在阻止我的唯一问题。我可以发布某些

| >代码的子部分,但它非常密集,所以我想尝试一下

| >首先说明问题。

| >

| >理想情况下,有人可以告诉我到底我做错了什么,因为

| >他们之前遇到过这个问题。如果我有
|,请随意嘲笑我>做了一件非常愚蠢的事情!

| >

| >在此先感谢您提供任何帮助。

| >

| >问候,

| >

| >布莱斯

| >

|

|
You don''t have to marshal interface pointers yourself, The CLR takes care
of this for you by calling ole32!CoMarshalInterface whenever an ITF pointer
changes context.

Willy.


"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:ei*************@TK2MSFTNGP14.phx.gbl...
| Bryce,
|
| I''m a little concerned about you passing the COM object reference to
| another thread (and possibly, another apartment).
|
| How are you marshaling the COM interface pointer? You can''t just pass
| COM interface pointers across threads (depending on the apartments). It
| will cause problems if you are not careful here, to say the least. You
have
| to be aware of the apartment that the thread is in, as well as the
apartment
| that the component demands.
|
| Also, the callback methods, are they COM interface pointers as well?
| These have to be marshaled correctly to the thread making the callbacks.
|
| You also state:
|
| Finally, I explicitly set both my main thread and child threads to have an
| apartment state of STA (by decorating the appropriate methods in the main
| thread).
|
| The attributes to set the apartment state for the main thread of an
| application (like STAThread) only work for the entry point of the
| application. From the documentation of STAThread:
|
| Apply this attribute to the entry point method (the Main() method in C#
and
| Visual Basic). It has no effect on other methods. To set the apartment
state
| of threads you start in your code, use the Thread.SetApartmentState method
| before starting the thread.
|
| Looking at the problem statement, it appears that you have to marshal
| the interface pointer correctly. You need to register on the global
| interface table and pass the cookie, or you can marhsal to a stream and
then
| unmarshal it.
|
| I''m a little vague on the details on how much of this is .NET code, and
| how much is VB/C++ code. Needless to say, the mechanism will be the same
in
| all of them. What it comes down to is that you have to marshal COM
| interface pointers across apartment boundaries correctly, and it looks
like
| you might not be defining those boundaries, or passing them correctly.
|
| Hope this helps.
|
|
| --
| - Nicholas Paldino [.NET/C# MVP]
| - mv*@spam.guard.caspershouse.com
|
| "Bryce Calhoun" <bc******@gmail.com> wrote in message
| news:11**********************@g47g2000cwa.googlegr oups.com...
| > Hello,
| >
| > First of all, this is a .NET 1.1 component I''m creating.
| >
| > SUMMARY
| > -----------------------
| >
| > This component that I''m creating is, for all intents and purposes, a
| > document parser (I''m actually deserializing a SOAP document into an
| > object and parsing out the fields, but that''s fairly immaterial to this
| > issue).
| >
| > This component is instantiated by a VB 6.0 "manager" object, and is
| > passed by reference a C++ COM data object which, in a separate thread
| > within the parser, I populate with a bunch of child objects that are
| > instantiated as necessary. This C++ COM object is basically a very
| > robust data object, which contains individual children which are record
| > nodes.
| >
| > I should mention that I can''t change the signature of the method that
| > receives the parameters, as the interface has been defined and locked
| > down already.
| >
| > When I''m done with all my parsing, I invoke my callback method (as I
| > stated before, the parsing occurs on a separate thread), which then
| > notifies the manager that the parsing is complete, and that it can save
| > the contents of the data object (which it already has a handle to).
| >
| > I''ve checked the active state of the child thread prior to notifying
| > the manager object, and it says it''s no longer alive. I''m also in the
| > correct thread (I checked the names I assigned the threads) when I
| > notify the manager that parsing is complete. Finally, I explicitly set
| > both my main thread and child threads to have an apartment state of STA
| > (by decorating the appropriate methods in the main thread).
| >
| > PROBLEM
| > ---------------------------
| >
| > My problem is that I get an error within the data object (after it has
| > been passed back into the VB manager, and my parsing has completed)
| > having to do with it being unable to write to the system security log.
| >
| >
| > **This does not appear to be the fault of the application, but rather,
| > my code''s fault, because if I run all my code synchronously, the data
| > object is able to save everything fine, and is able to write to the
| > system security log.**
| >
| > I''m passing in the data object to my child thread within the thread''s
| > constructor (by reference), and, within that separate thread, it''s able
| > to access and manipulate all the properties and methods necessary to
| > add/delete/modify threats.
| >
| > QUESTION
| > --------------------
| >
| > My question is, do I need to do something special (e.g. some esoteric
| > marshalling command) to ensure that the COM data object is not going to
| > get corrupted or become invalid for some reason within the child
| > thread? What typically is done to COM objects (wrapped in the RCW)
| > prior to them being passed into separate threads? Am I completely
| > missing something?
| >
| > Anything you guys can suggest would be extremely helpful, as this is
| > pretty much the only issue holding me up now. I could post certain
| > sub-sections of the code, but it''s pretty dense, so I wanted to try a
| > description of the issue first.
| >
| > Ideally, someone can tell me exactly what I''m doing wrong because
| > they''ve experienced the problem before. Feel free to mock me if I''ve
| > done something extraordinarily stupid, as well!
| >
| > Thanks in advance for any help you can give.
| >
| > Regards,
| >
| > Bryce
| >
|
|


这篇关于在.NET中线程/编组COM的问题(?)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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