-
Notifications
You must be signed in to change notification settings - Fork 95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed issue where MM would crash the game due to a DLL being renamed #177
Conversation
before MM was able to get the file version. The rename was from ZeroMiniAVC, which was renaming the MiniAVC.dll and MiniAVC_v2.dll files, and them MM was getting a FileNotFound error
The problem is that the MiniAVC.DLLs are renamed after KSP enumerates them in memory. The ideal solution is to restart KSP after renaming the MiniAVC.dlls . Otherwise you will need to make pull requests to every Assembly that uses Reflection - including KSP itself. |
The fix I put in was a simple try/catch, to avoid the FileNotFound exception. I tested this in a 1.12.4 install where I was able to replicate the error, with the fix it's not there Yes, that's the ideal situation, since this is the only mod that has an error with this, it's a good fix |
Are you going to do a pull request on EVERY add-on and also on KSP itself? because otherwise you are only masking the problem where it's more visible. |
The ideal solution is not install MiniAVC*.dll at all, unless the user wants it. Since this ship has sailed, you need to realise that by the time you prune the DLL it was already registered by KSP and so everything (and I really mean it) that tries to enumerate the available Assemblies will bork. The only real fixes for the problem is:
Any other half-baked solution will make 3rd parties to blow up, spreading further the damage that it's already being done. |
I had come to a solution for this problem by pure accident. Apparently, only the first loaded DLL needs to be present on the filesystem, all the other duplicates can be safely pruned from it (including on KSP < 1.8.0). So a possible solution to this problem is to have a folder called ZeroMiniAVC must be instrumented to do not run from the From this point, removing all the others I think some tests are needed to be absolutely sure this will stick to ZeroMiniAVC, but the results I got on my rig looks promising. (in time, this Pull Request really should be closed without merging) |
If you are going to leave a DLL on the system, why not just install the latest ZeroMiniAVC, which deletes all of them, AND puts in a MiniAVC.dll which it uses to do the same thing you are describing? |
Because by removing every single copy of the DLL will crash the Reflection if anyone tries to use it unless by rebooting KSP, exactly as it happened to Module Manager here. Leaving a "reference" DLL, dormant, will garantee that the Reflection will be happy after removing the all the other DLLs (since KSP 1.12.x short-circuits all the duplicates to the one it elects as the dominant by looking into the Assembly Version). The reason Module Manager was crashing was due this problem at first place - and since you found the need to do this P/R even by CKAN removing all the MiniAVC.dlls from the system, it was obvious to me that you was getting some heat from people not using CKAN. This dirty trick will allow ZeroMiniAVC to delete all the MiniAVC.DLL from the system without the need to restart KSP, as long the one KSP chooses to be loaded still pinpoints to a existent DLL in the file system. |
Ummm, ZeroMiniAVC DOES have a reference dll as part of it. Its a null dll, does nothing other than solve this problem. |
before MM was able to get the file version. The rename was from ZeroMiniAVC, which was renaming the MiniAVC.dll and MiniAVC_v2.dll files, and them MM was getting a FileNotFound error
This is a critical issue for anyone trying to start a game with any MiniAVC.dll files