Same assembly, different version, appdomain issue.

SyntaxEditor for WPF Forum

Posted 8 years ago by Frederik St-Onge
Version: 16.1.0632
Avatar

Hello,

I am currently facing an issue where if i delete a referenced assembly and add the same assembly, but different version, it crashes because it is already loaded in the appdomain (Even in your example project). I tried to isolate the ProjectAssembly in a separate appdomain, i've done over 30 Remoting class with MarshalByRefObject but couldn't make it work. 

Is there an easy way to clear the appdomain from loaded dll? What is the best practice in that case?

Thank you.

[Modified 8 years ago]

Comments (2)

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

Hi Frederik,

This scenario is difficult because of the way Microsoft implemented reflection and its inability to reload assemblies after they've been re-generated.  There's no way to remove an assembly from an AppDomain once it's been loaded once, which is the main issue.

I wonder if you could use a separate AppDomain and in that, load up the assembly then make a new stub project assembly and set its cache path the same as the real project assembly's cache path.  Have it write out the cache data to the files.  Once that is done, back in the main app domain, load the cache data manually.

If you look in the .NET Languages Add-on's documentation's "Assemblies" topic, the last section in that topic has info on how to do those steps outside of an AppDomain.  You'd have to combine that sort of logic with AppDomain logic, but I think the concept would work.


Actipro Software Support

Posted 8 years ago by Frederik St-Onge
Avatar

I will need to do more testing but it seems to work fine for now! Thank you for your support, I really appreciate it :)

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.