Well, Application Domain is a .NET concept and is quite difficult to
understand. many (if not most) programmers do not directly deal with it. I
am not sure I understand it much, but here is some points.
1. Application Domain is about separating running managed code in minimum
memory space, so that the affect of possible error/crash to the working
process could be limited as much as possible. It is a memory space managed
by .NET runtime (CLR) to safe guard the memory use/abuse. It has nothing to
do with where the .NET dll (acdbmgd.dll/acmgd.dll) is loaded from (GAC or
not), nor it has anything to do with whether it is loaded at Acad startuo or
not.
2. A working operating system process (such as AutoCAD running process, or
an pure .NET exe process) may contain one or more Application Domains. It is
unlikely that your ARX .NET managed code runs in the same Application Domain
as AutoCAD (remember AppDomain is a .NET concept). AutoCAD exe is a process,
your ARX managed code runs in the same process, but in its own AppDomain.
And your managed code may create multiple AppDomains and runs in them.
3. ARX .NET API is mainly .NET wrapper of unmanaged code (so far, pure .NET
API may be available more and more for future Acad versions, who knows),
even with the AppDomain in place, it is still difficult to predict or
prevent Acad crash. Everyone who has done enough .NET programming must have
experienced this situation: your .NET application may run into an unhandled
exception, but your app does not die. Instead, .NET runtime displays a
message dialog box with 3 buttons. "Detail" bttuon allows you to see
exception stack infor; "Cancel" button shuts down your app immediately; and
"Continue" button keeps the app still alive (but if the app will work
normally from then on is another thing, depending on the nature of the
exception). The "Continue" option is mainly due to the AppDomain's
protection so that the app is still alive in spite of unhandled exception.
If it was an unmanaged app, your app would die immediately in such
situation. However, in ARX .NET app, some unhandled exception may cause this
.NET runtime message, some may simply crash Acad immediately. That is
because the ARX .NET code as the wrapper of unmanaged code, If the exception
is raised from the unmanaged code, the .NET AppDomain would not take effect
here.
Just my understanding, it may not be correct, though.
"sardanapalo" wrote in message news:
[email protected]...
Basic question, I guess, but need to be sure.
Since acdbmng.dll and acmng.dll are not in the GAC, the fact that I can
install my ARX.net dll on any folder is because it will run on the same
application domain as Autocad, where acdbmng.dll and acmng.dll are loaded at
Autocad startup. Right?