3
votes

I have a .Net class that calls a c++ COM object which in turn calls another .Net class in COM. I've found that the two .Net classes are in seperate appdomains (which makes some trouble with log4net). Note they are in the same thread though.

Why is this? Is there a way to ensure they will be in the same appdomain?

1
In what context? IIS, desktop application? - Ricardo Nolde

1 Answers

0
votes

Calling a .NET class that is exposed as COM requires marshaling of data. AppDomains separates data access. When you call a COM component (regardless of it's being a .NET app) you have to make it sand-boxed. In .NET, sand-boxing is using different AppDomain.