Assembly resolving issue in 2013.1.580

SyntaxEditor for WPF Forum

Posted 11 years ago by Nick
Version: 13.1.0580
Platform: .NET 4.5
Environment: Windows 8 (64-bit)
Avatar

Hello,

We recently upgraded to the newest release (from the latest 2012.2 release), and noticed a small issue apparently in the Project.AssemblyReferences.AddFrom method. I have looked through the source history for our custom assembly resolver class and I don't believe this has been caused by an internal change.

Code that doesn't work:

 

foreach (var reference in DynamicClassHelper.GetCommonReferences())
{
  try
  {
    m_SyntaxEditorProject.AssemblyReferences.AddFrom(reference);
  }
  catch (Exception ex)
  {
   ...
  }
}

Assembly A
Assembly B, references Assembly A.

Assembly A is added first, then assembly B. Our assembly resolver correctly resolves A and it is added. Our assembly resolver then resolves B, and a subsequent call to resolve A is then called. Our assembly resolver returns null as it is already loaded. Intellisense stops working for both Assembly A and B.

Code that works:

foreach (var reference in DynamicClassHelper.GetCommonReferences())
{
  try
  {
    var a = Assembly.LoadFrom(reference);
    if (a != null)
      m_SyntaxEditorProject.AssemblyReferences.Add(a);
  }
  catch (Exception ex)
  {
    ...
  }
 }

The lower code seems to have fixed the issue, but I'm not sure if other users will encounter this.

I'll not be providing any sample projects as I believe this is now working. This is FYI.

[Modified 11 years ago]

Comments (1)

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

Hi Nick,

The one change I see that we made in 2013.1 that could be causing this is in our AppDomain.AssemblyResolve handler (which tries to load up referenced assemblies), we used to do Assembly.ReflectionOnlyLoadFrom(path).  But we changed it to Assembly.ReflectionOnlyLoad(File.ReadAllBytes(path)).

We had done this change based on a customer recommendation since the ReflectionOnlyLoadFrom method locks the file the other way doesn't.

I still would like to see a simple sample project so we could see if we can come up with anything else.  The best thing to do would be to have a Cecil-based implementation so no Microsoft reflection is used at all.  That's something we may add as an option down the road.


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.