tgjones / gemini

Gemini is an IDE framework similar in concept to the Visual Studio Shell. It uses AvalonDock and has an MVVM architecture based on Caliburn Micro.
Other
1.1k stars 298 forks source link

Do Not Save Application State In Debug Mode #315

Open ChayimFriedman2 opened 4 years ago

ChayimFriedman2 commented 4 years ago

First, thanks for the excellent framework! 🥇

Gemini automatically saves all modules state in ./Application.bin. This is great as this automatically stores the layout and reducing the work you need to do.

However I installed the Inspector module, and configured it to be opened at startup. Lately, I found PropertyGrid is more appropriate in my case, so I replaced the code. But that didn't work! 😢

I debugged the decompiled code of the library (using dnSpy a great tool by the way), and lastly found that the application restored my previous layout which was stored in ./Application.bin, and because the restore succeed, it didn't try to use the code's DefaultTools. The immediate solution was, obviously, to delete it (btw I deleted bin and obj folders entirely).

Because such changes are common in debug mode, and because we don't want to loss the functionality of recovering application's state, I think we need to turn this feature off in debug mode (maybe using conditional compilation).

Thank you again for the great work.

kornman00 commented 2 years ago

Refer to Gemini.Modules.Shell.ViewModels.ShellViewModel

It has a virtual property called StateFile. You could have your application implement its own IShell that extends from this class and override StateFile so it returns a different file name when running under #if DEBUG