Groups | Blog | Home
all groups > dotnet interop > february 2006 >

dotnet interop : How to achieve isolation of an un-threadsafe COM DLL used from .NE


Shahid Hasan Faruqi
2/17/2006 3:45:27 PM
Greetings,

I am using a third party COM DLL which is not thread safe. I need to be able
to make several instances of objects in that DLL using threads from an
ASP.NET application without getting deadlocks/problems.

I tried using Application Domains but still got thread deadlocks. Then I
resorted to using COM+ with Activation option as Server, then I noticed most
deadlocks were gone but still in one area I'm noticing exceptions which are
almost certainly caused by multi-threading (single request case works fine).

Question is, what is the prescribed way to achieve isolation in .NET when
one is using a COM in-process component? Also, would static variables if
defined in the COM component be isolated too?

I would appreciate if someone helps me.

Thank you,

--
Shahid H. Faruqi
Willy Denoyette [MVP]
2/18/2006 1:26:26 AM

"Shahid Hasan Faruqi" <ShahidHasanFaruqi@discussions.microsoft.com> wrote in
message news:B83C6722-B813-4183-97BA-A1FAC0E967A8@microsoft.com...
| Greetings,
|
| I am using a third party COM DLL which is not thread safe. I need to be
able
| to make several instances of objects in that DLL using threads from an
| ASP.NET application without getting deadlocks/problems.
|
| I tried using Application Domains but still got thread deadlocks. Then I
| resorted to using COM+ with Activation option as Server, then I noticed
most
| deadlocks were gone but still in one area I'm noticing exceptions which
are
| almost certainly caused by multi-threading (single request case works
fine).
|
| Question is, what is the prescribed way to achieve isolation in .NET when
| one is using a COM in-process component? Also, would static variables if
| defined in the COM component be isolated too?
|
| I would appreciate if someone helps me.
|
| Thank you,
|
| --
| Shahid H. Faruqi
| Software Developer

Make sure you are running in asp compatibility mode when loading COM types.
look for the aspcompat=true page directive.

Willy.

AddThis Social Bookmark Button