2 ProjectAssembly can't reference the same Assembly

SyntaxEditor .NET Languages Add-on for WPF Forum

Posted 11 years ago by Nicolas
Version: 13.1.0583
Platform: .NET 4.0
Environment: Windows 7 (32-bit)
Avatar

This bug is new in the 583 build.
Try this :

ProjectAssembly project1 = new ProjectAssembly("MyProject1");
ProjectAssembly project2 = new ProjectAssembly("MyProject2");
string referencePath = @"C:\MyAssembly.dll";
IProjectAssemblyReference assemblyRef1 =project1.AssemblyReferences.AddFrom(referencePath);
IProjectAssemblyReference assemblyRef2 =project2.AssemblyReferences.AddFrom(referencePath);

Here assemblyRef2 is null and project2.AssemblyReferences.Count is 0

I known the .Net Add-on use reflection to analyse references (this is not a good idea... : reflection is for runtime, not for static analyse)

It seems now, the assembly respository use

Assembly.ReflectionOnlyLoad(File.ReadAllBytes(path));

instead of

Assembly.ReflectionOnlyLoadFrom(path);

So, the second call throw a FileLoadException : "Assembly already loaded from other path..."

I hope Actipro will devellope an IAssemblyRespository based on a IL dissasembler (Mono.Cecil, CCI Metadata...)

Comments (3)

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

Hi Nicolas,

Unfortunately it is frustrating that reflection locks the assemblies in this manner.  We do have a suggestion to use Cecil as an option for loading assembly data.  I'll add this forum thread to that request.


Actipro Software Support

Posted 10 years ago by 7Alpha7
Avatar

Hello,

is this bug fixed ? I have the same problem. I use specific assembly loading service and I had to adapt it to use the ReflectionOnlyAssemblyResolve event. However, since previously the AssemblyResolve event fired for the same assembly, already loaded, I get the same exception. I am stuck and I don't know what to do to get intellisense back !

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

Hello,

Sorry we have not made an additional Cecil-based loading option yet.


Actipro Software Support

The latest build of this product (v24.1.1) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.