<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Application domain and managed ARX in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/application-domain-and-managed-arx/m-p/2606295#M67818</link>
    <description>Basic question, I guess, but need to be sure.&lt;BR /&gt;
&lt;BR /&gt;
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?</description>
    <pubDate>Sun, 20 Dec 2009 13:41:43 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2009-12-20T13:41:43Z</dc:date>
    <item>
      <title>Application domain and managed ARX</title>
      <link>https://forums.autodesk.com/t5/net-forum/application-domain-and-managed-arx/m-p/2606295#M67818</link>
      <description>Basic question, I guess, but need to be sure.&lt;BR /&gt;
&lt;BR /&gt;
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?</description>
      <pubDate>Sun, 20 Dec 2009 13:41:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/application-domain-and-managed-arx/m-p/2606295#M67818</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-12-20T13:41:43Z</dc:date>
    </item>
    <item>
      <title>Re: Application domain and managed ARX</title>
      <link>https://forums.autodesk.com/t5/net-forum/application-domain-and-managed-arx/m-p/2606296#M67819</link>
      <description>Well, Application Domain is a .NET concept and is quite difficult to &lt;BR /&gt;
understand. many (if not most) programmers do not directly deal with it. I &lt;BR /&gt;
am not sure I understand it much, but here is some points.&lt;BR /&gt;
&lt;BR /&gt;
1. Application Domain is about separating running managed code in minimum &lt;BR /&gt;
memory space, so that the affect of possible error/crash to the working &lt;BR /&gt;
process could be limited as much as possible. It is a memory space managed &lt;BR /&gt;
by .NET runtime (CLR) to safe guard the memory use/abuse. It has nothing to &lt;BR /&gt;
do with where the .NET dll (acdbmgd.dll/acmgd.dll) is loaded from (GAC or &lt;BR /&gt;
not), nor it has anything to do with whether it is loaded at Acad startuo or &lt;BR /&gt;
not.&lt;BR /&gt;
&lt;BR /&gt;
2. A working operating system process (such as AutoCAD running process, or &lt;BR /&gt;
an pure .NET exe process) may contain one or more Application Domains. It is &lt;BR /&gt;
unlikely that your ARX .NET managed code runs in the same Application Domain &lt;BR /&gt;
as AutoCAD (remember AppDomain is a .NET concept). AutoCAD exe is a process, &lt;BR /&gt;
your ARX managed code runs in the same process, but in its own AppDomain. &lt;BR /&gt;
And your managed code may create multiple AppDomains and runs in them.&lt;BR /&gt;
&lt;BR /&gt;
3. ARX .NET API is mainly .NET wrapper of unmanaged code (so far, pure .NET &lt;BR /&gt;
API may be available more and more for future Acad versions, who knows), &lt;BR /&gt;
even with the AppDomain in place, it is still difficult to predict or &lt;BR /&gt;
prevent Acad crash. Everyone who has done enough .NET programming must have &lt;BR /&gt;
experienced this situation: your .NET application may run into an unhandled &lt;BR /&gt;
exception, but your app does not die. Instead, .NET runtime displays a &lt;BR /&gt;
message dialog box with 3 buttons. "Detail" bttuon allows you to see &lt;BR /&gt;
exception stack infor; "Cancel" button shuts down your app immediately; and &lt;BR /&gt;
"Continue" button keeps the app still alive (but if the app will work &lt;BR /&gt;
normally from then on is another thing, depending on the nature of the &lt;BR /&gt;
exception). The "Continue" option is mainly due to the AppDomain's &lt;BR /&gt;
protection so that the app is still alive in spite of unhandled exception. &lt;BR /&gt;
If it was an unmanaged app, your app would die immediately in such &lt;BR /&gt;
situation. However, in ARX .NET app, some unhandled exception may cause this &lt;BR /&gt;
.NET runtime message, some may simply crash Acad immediately. That is &lt;BR /&gt;
because the ARX .NET code as the wrapper of unmanaged code, If the exception &lt;BR /&gt;
is raised from the unmanaged code, the .NET AppDomain would not take effect &lt;BR /&gt;
here.&lt;BR /&gt;
&lt;BR /&gt;
Just my understanding, it may not be correct, though.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
"sardanapalo" wrote in message news:6307538@discussion.autodesk.com...&lt;BR /&gt;
Basic question, I guess, but need to be sure.&lt;BR /&gt;
&lt;BR /&gt;
Since acdbmng.dll and acmng.dll are not in the GAC, the fact that I can &lt;BR /&gt;
install my ARX.net dll on any folder is because it will run on the same &lt;BR /&gt;
application domain as Autocad, where acdbmng.dll and acmng.dll are loaded at &lt;BR /&gt;
Autocad startup. Right?</description>
      <pubDate>Sun, 20 Dec 2009 16:04:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/application-domain-and-managed-arx/m-p/2606296#M67819</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-12-20T16:04:11Z</dc:date>
    </item>
    <item>
      <title>Re: Application domain and managed ARX</title>
      <link>https://forums.autodesk.com/t5/net-forum/application-domain-and-managed-arx/m-p/2606297#M67820</link>
      <description>If your app wasn't loaded into the same AppDomain as AutoCAD's clr host,&lt;BR /&gt;
you wouldn't be able to use many of its APIs, so the answer is yes.&lt;BR /&gt;
&lt;BR /&gt;
However, because of some obscure problems related to how AutoCAD&lt;BR /&gt;
loads managed extension dlls, there are cases where they can fail if they&lt;BR /&gt;
are not located in the same folder where acad.exe is.&lt;BR /&gt;
&lt;BR /&gt;
-- &lt;BR /&gt;
http://www.caddzone.com&lt;BR /&gt;
&lt;BR /&gt;
AcadXTabs: MDI Document Tabs for AutoCAD&lt;BR /&gt;
Supporting AutoCAD 2000 through 2010&lt;BR /&gt;
&lt;BR /&gt;
http://www.acadxtabs.com&lt;BR /&gt;
&lt;BR /&gt;
Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");&lt;BR /&gt;
&lt;BR /&gt;
&lt;SARDANAPALO&gt; wrote in message news:6307538@discussion.autodesk.com...&lt;BR /&gt;
Basic question, I guess, but need to be sure.&lt;BR /&gt;
&lt;BR /&gt;
Since acdbmng.dll and acmng.dll are not in the GAC, the fact that I can&lt;BR /&gt;
install my ARX.net dll on any folder is because it will run on the same&lt;BR /&gt;
application domain as Autocad, where acdbmng.dll and acmng.dll are loaded at&lt;BR /&gt;
Autocad startup. Right?&lt;/SARDANAPALO&gt;</description>
      <pubDate>Mon, 21 Dec 2009 17:37:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/application-domain-and-managed-arx/m-p/2606297#M67820</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-12-21T17:37:34Z</dc:date>
    </item>
    <item>
      <title>Re: Application domain and managed ARX</title>
      <link>https://forums.autodesk.com/t5/net-forum/application-domain-and-managed-arx/m-p/3577282#M67821</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to call a function from another .dll via domain so that I can unload the .dll.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Originally my function used Assembly.Load. However I could not update the .dll file whilst within AutoCAD.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Public &lt;FONT face="Consolas" color="#0000ff" size="2"&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;Shared&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;Sub&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; InvokeAutoCADCommand(&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;ByVal&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; strCommandName &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;As&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;String&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;,&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;ByVal&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; fullPathDllName &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;As&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;String&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Consolas" color="#008000" size="2"&gt;&lt;FONT face="Consolas" color="#008000" size="2"&gt;&lt;FONT face="Consolas" color="#008000" size="2"&gt;'Dim adevidence As Evidence = AppDomain.CurrentDomain.Evidence&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;Dim&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; appDomSetup &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;As &lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;New &lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" color="#2b91af" size="2"&gt;&lt;FONT face="Consolas" color="#2b91af" size="2"&gt;&lt;FONT face="Consolas" color="#2b91af" size="2"&gt;AppDomainSetup&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;Dim&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; domain &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;As &lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" color="#2b91af" size="2"&gt;&lt;FONT face="Consolas" color="#2b91af" size="2"&gt;&lt;FONT face="Consolas" color="#2b91af" size="2"&gt;AppDomain&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; = &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" color="#2b91af" size="2"&gt;&lt;FONT face="Consolas" color="#2b91af" size="2"&gt;&lt;FONT face="Consolas" color="#2b91af" size="2"&gt;AppDomain&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;.CreateDomain(&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" color="#a31515" size="2"&gt;&lt;FONT face="Consolas" color="#a31515" size="2"&gt;&lt;FONT face="Consolas" color="#a31515" size="2"&gt;"MyDomain"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;, &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;Nothing&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;, appDomSetup)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Consolas" color="#008000" size="2"&gt;&lt;FONT face="Consolas" color="#008000" size="2"&gt;&lt;FONT face="Consolas" color="#008000" size="2"&gt;'Dim assemblyBytes As Byte() = File.ReadAllBytes(fullPathDllName)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Consolas" color="#008000" size="2"&gt;&lt;FONT face="Consolas" color="#008000" size="2"&gt;&lt;FONT face="Consolas" color="#008000" size="2"&gt;'Dim objAssembly As Assembly = Assembly.Load(assemblyBytes)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;Dim&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; objAssembly &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;As&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" color="#2b91af" size="2"&gt;&lt;FONT face="Consolas" color="#2b91af" size="2"&gt;&lt;FONT face="Consolas" color="#2b91af" size="2"&gt;Assembly&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; = domain.Load(fullPathDllName)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;For &lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;Each&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; objType &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;As&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" color="#2b91af" size="2"&gt;&lt;FONT face="Consolas" color="#2b91af" size="2"&gt;&lt;FONT face="Consolas" color="#2b91af" size="2"&gt;Type&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;In&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; objAssembly.GetTypes()&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;If&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; objType.IsClass = &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;True &lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;Then&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;If&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; objType.Name.ToLower = strCommandName.ToLower &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;Then&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;Dim&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; ibaseObject &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;As&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;Object&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; = &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" color="#2b91af" size="2"&gt;&lt;FONT face="Consolas" color="#2b91af" size="2"&gt;&lt;FONT face="Consolas" color="#2b91af" size="2"&gt;Activator&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;.CreateInstance(objType)&lt;/FONT&gt;&lt;/FONT&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;Dim&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; arguments &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;As&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;Object&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;() = &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;New&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;Object&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;() {}&lt;/FONT&gt;&lt;/FONT&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;Dim&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; mi &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;As &lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" color="#2b91af" size="2"&gt;&lt;FONT face="Consolas" color="#2b91af" size="2"&gt;&lt;FONT face="Consolas" color="#2b91af" size="2"&gt;MethodInfo&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; = objType.GetMethod(strCommandName)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;mi.Invoke(ibaseObject, arguments)&lt;/P&gt;&lt;P&gt;&lt;FONT face="Consolas" color="#008000" size="2"&gt;&lt;FONT face="Consolas" color="#008000" size="2"&gt;&lt;FONT face="Consolas" color="#008000" size="2"&gt;'objType.InvokeMember(Nothing, Nothing, Nothing, Nothing, Nothing)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Consolas" color="#008000" size="2"&gt;&lt;FONT face="Consolas" color="#008000" size="2"&gt;&lt;FONT face="Consolas" color="#008000" size="2"&gt;'objType.InvokeMember(strCommandName, BindingFlags.[Default] Or BindingFlags.InvokeMethod, Nothing, ibaseObject, arguments)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Consolas" color="#008000" size="2"&gt;&lt;FONT face="Consolas" color="#008000" size="2"&gt;&lt;FONT face="Consolas" color="#008000" size="2"&gt;'objType.InvokeMember(strCommandName, BindingFlags.[Default] Or BindingFlags.InvokeMethod, Nothing, Nothing, arguments)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;Exit For&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;End &lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;If&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;End &lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;If&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;Next&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Consolas" color="#2b91af" size="2"&gt;&lt;FONT face="Consolas" color="#2b91af" size="2"&gt;&lt;FONT face="Consolas" color="#2b91af" size="2"&gt;AppDomain&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;.Unload(domain)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;End &lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;&lt;FONT face="Consolas" color="#0000ff" size="2"&gt;Sub&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Aug 2012 07:28:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/application-domain-and-managed-arx/m-p/3577282#M67821</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-08-14T07:28:26Z</dc:date>
    </item>
    <item>
      <title>Re: Application domain and managed ARX</title>
      <link>https://forums.autodesk.com/t5/net-forum/application-domain-and-managed-arx/m-p/3588476#M67822</link>
      <description>&lt;P&gt;Hi David,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Unless you have time to loose, I would discourage you trying to create your own AppDomain in order to make your AutoCAD dll unloadable. I personally tried to achieve that, and succeeded to some extent, as I was able to perform cross domain calls involving AutoCAD.Net API, however doing so, even using very simple APIs, just made AutoCAD unstable and reliably crashing at shutdown. I was told by the .Net development team that there are some globals variable in AutoCAD .Net core that would prevent cross domain workflow to work properly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Concerning your code, you need to use "CreateInstanceAndUnwrap" if you want to perform cross domain calls. Also your current approach is wrong straight from the beginning: you have to realize that even accessing the existing types of an assembly from your command, which is run from the default domain, will cause that assembly to be loaded in that domain, and therefore making it unloadable. You need to use proxies for anything you want to access from the default domain to the one you created, you need to derive your custom proxy classes from&amp;nbsp;&amp;nbsp;"MarshalByRefObject". I would suggest you take a look at some Microsoft documentation concerning "&lt;SPAN&gt;CreateInstanceAndUnwrap&lt;/SPAN&gt;" and "&lt;SPAN&gt;MarshalByRefObject&lt;/SPAN&gt;" if you are curious and not familiar with those concepts.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Philippe.&lt;/P&gt;
&lt;H1 class="title"&gt;&amp;nbsp;&lt;/H1&gt;</description>
      <pubDate>Mon, 20 Aug 2012 20:49:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/application-domain-and-managed-arx/m-p/3588476#M67822</guid>
      <dc:creator>philippe.leefsma</dc:creator>
      <dc:date>2012-08-20T20:49:07Z</dc:date>
    </item>
    <item>
      <title>Re: Application domain and managed ARX</title>
      <link>https://forums.autodesk.com/t5/net-forum/application-domain-and-managed-arx/m-p/3590154#M67823</link>
      <description>&lt;P&gt;Thank you very much for your reply,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am beginning to come to the same conclusion as you have, it looks pretty difficult. I have done some investigation into "CreateInstanceAndUnwrap" and "MarshalByRefObject". However the only examples I could find are using a class which exists within the same dll so I can't find how to reference a class which is in the new dll.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you have an example of what you did it would be most appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kind Regards&lt;/P&gt;&lt;P&gt;David&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Aug 2012 21:19:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/application-domain-and-managed-arx/m-p/3590154#M67823</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-08-21T21:19:37Z</dc:date>
    </item>
    <item>
      <title>Re: Application domain and managed ARX</title>
      <link>https://forums.autodesk.com/t5/net-forum/application-domain-and-managed-arx/m-p/3590194#M67824</link>
      <description>&lt;P&gt;Here is my test project, it contains a test assembly to be loaded and the AcadDotNetLoader.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There are couple of commands that illustrates how to access existing AppDomains and loaded assemblies, some of this code was tricky to put together.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can check how "DoNetLoad" command works and how I used the proxies to isolate the loaded dll types and methods from being loaded in the default appdomains.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you can make progress in this area, you are welcome to share;)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Philippe.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Aug 2012 21:41:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/application-domain-and-managed-arx/m-p/3590194#M67824</guid>
      <dc:creator>philippe.leefsma</dc:creator>
      <dc:date>2012-08-21T21:41:55Z</dc:date>
    </item>
  </channel>
</rss>

