Adding, removing and adding back the same assembly to IProjectAssembly, does not persist

SyntaxEditor .NET Languages Add-on for WPF Forum

Posted 9 years ago by Manoj
Version: 14.1.0610
Platform: .NET 4.5
Environment: Windows 7 (64-bit)



I added the Assembly X.dll to the 


then I remove the Assembly X.dll from


If Now I try to add again the 


the above code runs successfully, but it is not in the collection, it does not adds it.

Please advice ASAP.




Comments (1)

Posted 9 years ago by Actipro Software Support - Cleveland, OH, USA

Hi Manoj,

Unfortunately that is a behavior of .NET when trying to reflection load an assembly in the same appdomain where an assembly of the same name was previously loaded. .NET effectively throws:

FileLoadException' occurred in mscorlib.dll

API restriction: The assembly '' has already loaded from a different location. It cannot be loaded from a new location within the same appdomain.

It's an annoying restriction in .NET that many consider an unnecessary bug in the platform.

We have an item on our TODO list to possibly look into adding an option, where the assemblies would be loaded up into a separate AppDomain instead and the AppDomain immediately removed after the cache information is retrieved. We also could tie up with something like Cecil or Roslyn however those would require external dependencies that we're prefer to not have, so the first option is probably best. I'm not sure of a timeframe on that yet.

Actipro Software Support

The latest build of this product (v24.1.2) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.