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 99017
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T00:18:25+00:00 2026-05-11T00:18:25+00:00

Weird behavior when mixing loading of assemblies using Assembly.LoadFrom and Assembly.Load : I have

  • 0

Weird behavior when mixing loading of assemblies using Assembly.LoadFrom and Assembly.Load:

I have encountered a weird behavior when loading assemblies with Assembly.LoadFrom and later on with Assembly.Load. I am loading an assembly using Assembly.LoadFrom, where the assembly is located in a folder, which is not the execution folder.

Later on in my test code when I try to load once again this assembly with Assembly.Load, the load fails with a System.IO.FileNotFoundException (“Could not load file or assembly…”) despite the fact that the assembly is already loaded. The load fails both with the strong name and the non-strong name (the original reason for loading once again this assembly is a usage of a BinaryFormatter).

However, in case the assembly is located in the execution folder the later load succeeds in both cases, with the strong name and the non-strong name. In this case, you can see that two identical assemblies are loaded from two different locations.

A simple code sample that recreates this problem:

Assembly assembly1 = Assembly.LoadFrom(@"C:\a.dll");  // Loading with a strong-name fails Assembly assembly2 = Assembly.Load(@"a, Version=1.0.0.0, Culture=neutral, PublicKeyToken=14986c3f172d1c2c");  // Also loading with a non-strong fails Assembly assembly3 = Assembly.Load(@"a"); 
  1. Any explanation why the CLR ignores the already loaded assembly?
  2. Any idea how can I alleviate this problem?
  • 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. 2026-05-11T00:18:26+00:00Added an answer on May 11, 2026 at 12:18 am

    That’s not weird. As per the documentation, loading with Load and LoadFrom will place the assemblies in different contexts. This might help.

    1. Any explanation why the CLR ignores the already loaded assembly?

    Because they’re in a different context.

    1. Any idea how can I alleviate this problem?

    Load from the same context, or help the CLR find the assembly, perhaps by attaching a handler to AppDomain.AssemblyResolve.

    Alternative

    If the location you are loading assemblies from is a subfolder under AppDomain.BaseDirectory you can simply add an entry to your App.config:

    <configuration>    <runtime>       <assemblyBinding xmlns='urn:schemas-microsoft-com:asm.v1'>          <probing privatePath='bin;bin2\subbin;bin3'/>       </assemblyBinding>    </runtime> </configuration> 

    http://msdn.microsoft.com/en-us/library/823z9h8w.aspx

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

Sidebar

Ask A Question

Stats

  • Questions 61k
  • Answers 61k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer int() is the Python standard built-in function to convert a… May 11, 2026 at 9:36 am
  • added an answer Keep track of the predecessor nodes. In the easiest implementation,… May 11, 2026 at 9:36 am
  • added an answer Ok, servlets are smalish applications that are designed to run… May 11, 2026 at 9:36 am

Related Questions

Weird behavior when mixing loading of assemblies using Assembly.LoadFrom and Assembly.Load : I have
I've seen this weird behavior on several sites recently: I scroll down a page
I have some extremely weird behavior that seems to result in silent exceptions. How
I am seeing some rather weird behavior with PowerShell, it looks like custom functions
This is the day of weird behavior. We have a Win32 project made with
i recently stumbled upon a seemingly weird behavior that Google completely failed to explain.
I'm writing a simple .bat file and I've run into some weird behavior. There
I'm getting some weird behaviour recompiling some applications in 2009 that used widestrings at
A weird bug was occurring in production which I was asked to look into.
There are two weird operators in C#: the true operator the false operator If

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.