Force resolver refresh

SyntaxEditor for WPF Forum

Posted 7 years ago by Nick
Version: 12.1.0561
Avatar

Hello,

In a scenerio where the resolver has been passed a reference and then is passed a new reference, which has the same assemblyname, but is in fact a different assembly, is there a way to force the resolver to point to the new assembly?

We have users which are referencing a specific assembly but not incrementing the file or assembly version with each build of their assembly (the versions are tied to source control). In this case, the resolver is passed an assembly when loading the syntax editor, and intellisense functions as expected. Upon re-referencing a newly-build assembly (with the same assemblyname0, the old intellisense remains.

Thanks,
Nick.

Comments (8)

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

Hi Nick,

So I assume you have removed/re-added the reference to your IProjectAssembly, and it brought back the same thing?  If so, at this time you may need to Remove it from the FileBasedAssemblyRepository too in between your Remove/Add for the project assembly references.  See if that helps.  It should see a different assembly modification date and overwrite the cached data.


Actipro Software Support

Posted 7 years ago by Nick
Avatar

I tried that and was unable to get it working. Any other ideas or code snippets?

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

Hi Nick,

I'm not sure what else to suggest without being able to debug it.  If you'd like us to take a look, can you put together as simple of a repro scenario as possible and e-mail the ZIP to our support address?  Reference this post and be sure to rename the .zip file extension so it doesn't get spam blocked.


Actipro Software Support

Posted 7 years ago by Nick
Avatar

It's pretty easy to repro - open up your C# editor in the sample browser and add a reference to class library with one method: Method1(). All works as expected.

Then add Method2() to the class library, recompile, and re-reference in the sample browser. At this point the sample browser crashes for me, but in my real project the new method isn't picked up.

Please note that this is only an issue when the version of the class lib doesn't change.

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

Hi Nick,

The problem here is that Assembly.ReflectionOnlyLoad detects it's the same assembly name/version that already was loaded into the app domain.  Perhaps you could just update the revision number of the version?

If you will be dynamically updating assemblies without updating versions, you'd likely need to load the assembly into a separate AppDomain.  Then get your FileBasedAssemblyRepository and call Remove on the old one, and Add the new one from within the separate AppDomain.

Then go back to your main thread and remove/add the reference from your project.  I believe the new assembly will then get picked up.


Actipro Software Support

Posted 7 years ago by Nick
Avatar

Thanks for the info. I may try to implement what you suggest, or simply make it a requirement for the version to change.

Posted 7 years ago by Tarquin
Avatar

Hi

Im having a similar problem. I configure the syntax editor document with a DotNetSyntaxLanguageBase (usually CSharp but can also be VB). Im using MVVM and so need to do a bit of work in code as the ISyntaxLanguage property is not a dependancy property (hint hint..). This works and I can use intellisense for the referenced assemblies.

 I allow the user to select and add a new assembly reference which I add to the project as shown below. But the intellisense in the editor does not update? Am I missing something? Thanks

 

internal static void AddReference(DotNetSyntaxLanguageBase syntaxLanguage, Assembly assembly)
    {
      IProjectAssembly project = syntaxLanguage.GetService<IProjectAssembly>();
      project.AssemblyReferences.Add(assembly);
    }
Posted 7 years ago by Tarquin
Avatar

Duhh, sorry I forgot to add a using statement, it now works when I do that. Im so used to VS adding a using for me that I forgot to do it myself...

The latest build of this product (v2019.1 build 0683) 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.