Microsoft KB Archive/242554

= PRB: Shared Property Manager Does Not Manage Interface Pointers =

Article ID: 242554

Article Last Modified on 12/5/2007

-

APPLIES TO


 * Microsoft Transaction Services 2.0
 * Microsoft COM+ 1.0
 * Microsoft COM+ 1.5

-



This article was previously published under Q242554



SYMPTOMS
When you store an object reference or raw interface pointer in Shared Property Manager (SPM), you cannot retrieve it properly.



CAUSE
Storing object references into the SPM does not do any marshalling and unmarshalling of interface pointers. Therefore, problems will occur when you store interface pointers for apartment threaded components in SPM and then try to use them on the wrong thread.



RESOLUTION
Do not store interface pointers in SPM. Instead, you can store Global Interface Table (GIT) cookies.



STATUS
This behavior is by design.



MORE INFORMATION
The Shared Property Manager (SPM) gives components a way to store and share "stateful" information. For objects to share state, they must be running in the same server process.

SPM is useful for storing simple variables (strings, integers, arrays). You should not put references and interface pointers into the SPM because it does not do any marshalling and unmarshalling of interface pointers. It is just memory with some lock mechanisms in place. Therefore, problem will occur when you store interface pointers for apartment threaded components and then try to use them on the wrong thread.

Because apartment model components can only run on the thread that they were created on, the potential of two components waiting on the same thread also could occur and lead to a deadlock.

If you put object references in SPM, it simply AddRefs your object reference in the storing apartment and hands out cross-apartment references to objects in other activities or apartments. This will lead to erroneous results. Instead, any object references your object holds as data members have to be stored as apartment-neutral GIT cookies.

The GIT will do marshalling when storing object references and hand you back a cookie. This cookie can then be stored in the SPM.

Additional query words: interface mts COM+

Keywords: kbprb KB242554

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.