Author Topic: Why AcDbMgd.dll was loaded into the main AppDomain?  (Read 2118 times)

0 Members and 1 Guest are viewing this topic.

Andrey Bushman

  • Swamp Rat
  • Posts: 864
Why AcDbMgd.dll was loaded into the main AppDomain?
« on: October 26, 2016, 12:27:48 PM »
I work with AcCui.dll in my external application (i.e. it is not AutoCAD extension). I do it in the separate AppDomain. But I see that AcDbMgd.dll was loaded into my main AppDomain also. I don't understand why does it happen. The detailed example of my "Hello World" is here. I commented code and showed the screen.



Why does it happen and how can I fix it?
« Last Edit: October 26, 2016, 12:39:20 PM by Andrey Bushman »

MickD

  • King Gator
  • Posts: 3636
  • (x-in)->[process]->(y-out) ... simples!
Re: Why AcDbMgd.dll was loaded into the main AppDomain?
« Reply #1 on: October 26, 2016, 04:52:25 PM »
I'd be guessing it's because the .net classes are wrappers over the C++ classes and use/inherit the base wrapper class or interfaces from the main dll.

Sorry Andrey but I have to ask, why you are using the AcCui.dll for an external app though if it has nothing to do with AutoCAD??
"Programming is really just the mundane aspect of expressing a solution to a problem."
- John Carmack

"Short cuts make long delays,' argued Pippin.”
- J.R.R. Tolkien

Andrey Bushman

  • Swamp Rat
  • Posts: 864
Re: Why AcDbMgd.dll was loaded into the main AppDomain?
« Reply #2 on: October 26, 2016, 05:10:06 PM »

Sorry Andrey but I have to ask, why you are using the AcCui.dll for an external app though if it has nothing to do with AutoCAD??

I have DLL which is intended for configuring any (or almost any) AutoCAD. It edits registry settings and CUI\CUIX content. This DLL is for using by external applications. So, it can be used for creating of AutoCAD administrating utilities. Also it allows to recovery AutoCAD. For example, below is screen of its base set of interfaces. You can see the settings which it can provide and edit. All these interfaces have implementations. Also the solution has the projects with unit tests (NUnit and JustMock).

« Last Edit: October 26, 2016, 05:14:10 PM by Andrey Bushman »

MickD

  • King Gator
  • Posts: 3636
  • (x-in)->[process]->(y-out) ... simples!
Re: Why AcDbMgd.dll was loaded into the main AppDomain?
« Reply #3 on: October 26, 2016, 05:29:02 PM »
Cool, thanks for the explanation :)

"Programming is really just the mundane aspect of expressing a solution to a problem."
- John Carmack

"Short cuts make long delays,' argued Pippin.”
- J.R.R. Tolkien

Andrey Bushman

  • Swamp Rat
  • Posts: 864
Re: Why AcDbMgd.dll was loaded into the main AppDomain?
« Reply #4 on: October 26, 2016, 05:29:18 PM »
I forgot to show the enums:


Andrey Bushman

  • Swamp Rat
  • Posts: 864
Re: Why AcDbMgd.dll was loaded into the main AppDomain?
« Reply #5 on: October 26, 2016, 06:34:50 PM »
Hm... I think the  Hans Passant's answer is right:
Quote from: Hans Passant
I suppose the word "mixed" applies here. AppDomains are a pure managed concept, they only isolate managed objects. Any memory allocated by native code in a mixed-mode assembly is not isolated. It can't be. The isolation boundary for native code is a process.
If I correctly understood of his answer then any mixed assemblies always will be loaded into the main AppDomain also... :(