Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8533927
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T10:04:40+00:00 2026-06-11T10:04:40+00:00

Possible Duplicate: Unloading the Assembly loaded with Assembly.LoadFrom() I use custom AppDomain to load/unload

  • 0

Possible Duplicate:
Unloading the Assembly loaded with Assembly.LoadFrom()

I use custom AppDomain to load/unload assembly. But when assembly is unloaded I am able to see it under the AppDomain.CurrentDomain.

How it could be? Is this normal behavior or I am missing something?

Thank you for any clue!

 string assemblyPath = @"C:\MyFile.dll";
 var assemblyName = AssemblyName.GetAssemblyName(assemblyPath);

            var ads = new AppDomainSetup
                          {
                              ApplicationBase = AppDomain.CurrentDomain.SetupInformation.ApplicationBase, 
                              DisallowCodeDownload = true 
                          };

            AppDomain newDomainName = AppDomain.CreateDomain("newDomainName", null, ads);
              try
              {
                  Assembly testLibrary = newDomainName.Load(assemblyName);

                  var c1 = AppDomain.CurrentDomain.GetAssemblies();

                  var c2 = newDomainName.GetAssemblies();
              }
              finally
              {
                  AppDomain.Unload(newDomainName);

                  var c3 = AppDomain.CurrentDomain.GetAssemblies();

                  // The assembly is still visible here!!!
              }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T10:04:41+00:00Added an answer on June 11, 2026 at 10:04 am

    You are calling the Load() method of an AppDomain, which according to the documentation: “should be used only to load an assembly into the current application domain. This method is provided as a convenience for interoperability callers who cannot call the static Assembly.Load method. To load assemblies into other application domains, use a method such as CreateInstanceAndUnwrap.”

    In other words, you’re loading the assembly into the primary AppDomain because you’re calling Load() from the primary AppDomain (even though you’re using calling it on an instance of your secondary AppDomain), and this is why it is appearing even after you unload your secondary AppDomain.

    As indicated in the extract from the documentation above, you probably want to use AppDomain.CreateInstanceAndUnwrap.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Resizing an Image without losing any quality The code I always use
Possible Duplicate: CompilerServices.Operators equivalent on C# I was looking for Microsoft.CSharp.CompilerServices.Operators but couldn't find
Possible Duplicate: When should I use “using” blocks in C#? A lot of classes
Possible Duplicate: Unload a module in Python After importing Numpy, lets say I want
Possible Duplicate: how to use foursquare API in android application? This is a question
Possible Duplicate: git - removing a file from source control (but not from the
Possible Duplicate: Why not use tables for layout in HTML? Under what conditions should
Possible Duplicate: Why do I see a double variable initialized to some value like
Possible Duplicate: Limit jvm process memory on ubuntu In my application I'm uploading documents
Possible Duplicate: How do I make a request using HTTP basic authentication with PHP

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.