What have you all done as far as trying to keep an instance of Solidworks open while modifying API code, rebuilding, and giving it another test run without having to relaunch SWX every time?
I’m assuming that nobody has any consistent success with the Visual Studio Hot Reload button for add-ins (correct me if I’m wrong?)
It seems like a good solution would be creating a separate AppDomain in which the in-flux logic code assembly will be loaded. Conceptually, the persistent add-in/UI button assembly would load the logic assembly in the domain, run, then unload after execution. In this way the logic .dll will not be forever locked by the persistenly running add-in, and logic can be modified in VS and then run afresh next time the button is clicked.
So far, my problem is that I have to create a Loader class to load the logic assembly at runtime within the custom domain, and it’s always returning null, so that I can never get past that step. This feels like the strongest option that I’d like to resolve and use.
Currently, I have another solution that’s truly a hot reload but has these limitations: it can’t attach the debugger so the logic being tested has to rely on MessageBox for debug printing, and classes cannot be defined within the hot reload code. This approach is using the CSharp.Scripting extension, in which you keep a loose .cs file at solution level (not part of any project or build process) and write statements at toplevel (it can receive the app instance and other values as globals, and can import references to swx assemblies and your own utility classes).
So for certain types of testing that involves many small tweaks in quick succession, this scripting option seems like a big help (paste whatever is currently being targeted into the loose script.cs file) – in fact, you do not even have to rebuild, you can modify script.cs, save it, and your running swx instance will execute the new code next time you click the addin button – but I would still really like to discover a way to keep the debugger in play. AppDomain seems like a promising candidate for this, but does anyone have other ideas to enlighten me with?