Hi,
So I recently migrated all our code to a series of .NET Framework class libraries, publishing .dll files to our InventorRules directory.
But now that we're using them, it seems like if anyone has a document open in Inventor (or just a session of Inventor that had a document open at one point), I'm unable to replace the files, for instance to release a hot fix for an issue a coworker is experiencing, and would require that everyone in the company close all open instances of Inventor...
This is really bad. Does anyone know how I can get around this issue?
Thanks
Edit: to clarify, these .dll's are only being used by triggered rules, so even though Inventor is locking them, 99% of the time they aren't being actively used.
Solved! Go to Solution.
Solved by Michael.Navara. Go to Solution.
This is not a bug, this is a feature.
Because when application (Inventor in this case) starts, it creates AppDomain in memory. Application loads all required assemblies (simplified .dll files) to this AppDomain and this files can't be modified until the AppDomain is not closed (usually application terminates).
In your case when you have single copy of this DLL's somewhere on shared disk, you can't replace them until all Inventor instances are closed.
Option is to distribute this DLL's to each user (for example using group policy) and update them for example on logon.
Another option is to load required DLL's on demand using reflection from different locations. You can load different versions of the same assembly to one AppDomain. But it is little bit harder to implement this. You can see my project for debugging iLogic rules using VisualStudio where this technique is used.
Thanks for the reply
In fact, I've been looking into the feasibility of both these solutions, although it never occurred to me about using group policy.
Do you have any recommendations, in terms of what would be the most performant option?
Anyway, I'll take a look at the repo. Thanks!
That worked out perfectly, thanks! After adapting what I found in your repo I now have a proxy assembly, which is all that's locked by Inventor, with the rest of the class library being generated/loaded through it when/as needed.
I don't know how much testing you've done, but I'm curious to know what you've observed about nested referencing. I have my proxy 'AssemblyLoader' class that effectively interfaces trigger rules with the class library, but there's a hierarchy, where classes will invoke methods/instantiate objects of other subordinated classes of different .dll's.
One thing I had to do to get this to work for me is use `System.Reflection.Assembly.LoadFrom`, instead of `.LoadFile()`, I think because of these dependencies.
But if I'm fetching the latest version of the top-most class, what version of the bottom-most one does it call?
Edit: Found a VS extension to keep versions among projects in sync so I won't have to worry about it, as much as I may still be interested in whatever answers people might have.
Can't find what you're looking for? Ask the community or share your knowledge.