Closed PMoffitt05 closed 1 year ago
It's actually throwing that while trying to save <Game Root>/CKAN/GUIConfig.xml
. Does that file exist, and if so, can you please share its contents?
(The consoleui thing sounds like a secondary effect of GUI crashing in the first place while holding the lock.)
Browsing a web search for this error, the most plausible cause sounds like trying to use an assembly for an architecture that isn't supported on the system (think a 64-bit DLL on a 32-bit system). Since this is happening in a System.*
assembly, it'll be a DLL outside of CKAN, so the best bet is that there's something screwy with your .NET Framework install. Try uninstalling and reinstalling .NET Framework.
I will check .Net. Probably caused by some MS update after 7/2023. I haven't tried to run CKAN in a while.
More of the error (why didn't I have all this before?). Does it mater that I have Visual Studio installed coding in C# with .net?
Things I have tried since the first message:
Still getting the following:
************** Exception Text **************
System.InvalidProgramException: Common Language Runtime detected an invalid program.
at System.Xml.Serialization.XmlReflectionImporter..ctor(XmlAttributeOverrides attributeOverrides, String defaultNamespace)
at System.Xml.Serialization.XmlSerializer..ctor(Type type, String defaultNamespace)
at CKAN.GUI.GUIConfiguration.SaveConfiguration(GUIConfiguration configuration)
at CKAN.GUI.GUIConfiguration.LoadOrCreateConfiguration(String path, IGame game)
at CKAN.GUI.Main.OnLoad(EventArgs e)
at System.Windows.Forms.Form.OnCreateControl()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.Form.WmShowWindow(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
Updated Visual Studio. Still the same issue. Consoleui works as long as I don't try to change game instance. I managed to update my installed mods using consoleui. Granted, I had removed the KSP1 instances and set the KSP2 instance as default using command lines.
I still think MS updated something in Win 11 and broke CKAN and how it deals with that registry.lock file.
Tempting to download the code, compile it and run it in the debugger....
It's actually throwing that while trying to save
<Game Root>/CKAN/GUIConfig.xml
. Does that file exist, and if so, can you please share its contents?(The consoleui thing sounds like a secondary effect of GUI crashing in the first place while holding the lock.)
If I rename the CKAN folder, no that file does not exist after attempting to run CKAN in GUI mode.
Old CKAN Folder (which I am currently using again):
Contents of GUIConfig.xml (from old CKAN folder):
<?xml version="1.0" encoding="utf-8"?>
<Configuration xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<CommandLineArguments>KSP2_x64.exe -single-instance</CommandLineArguments>
<AutoCloseWaitDialog>false</AutoCloseWaitDialog>
<URLHandlerNoNag>false</URLHandlerNoNag>
<CheckForUpdatesOnLaunch>true</CheckForUpdatesOnLaunch>
<CheckForUpdatesOnLaunchNoNag>true</CheckForUpdatesOnLaunchNoNag>
<EnableTrayIcon>false</EnableTrayIcon>
<MinimizeToTray>false</MinimizeToTray>
<HideEpochs>true</HideEpochs>
<HideV>false</HideV>
<RefreshOnStartup>true</RefreshOnStartup>
<RefreshOnStartupNoNag>true</RefreshOnStartupNoNag>
<RefreshPaused>false</RefreshPaused>
<AutoSortByUpdate>true</AutoSortByUpdate>
<ActiveFilter>6</ActiveFilter>
<DefaultSearches>
<Search />
</DefaultSearches>
<SortColumns>
<string>ReleaseDate</string>
</SortColumns>
<MultiSortDescending>
<boolean>true</boolean>
</MultiSortDescending>
<HiddenColumnNames />
<IsWindowMaximised>true</IsWindowMaximised>
<WindowSize>
<Width>1358</Width>
<Height>743</Height>
</WindowSize>
<PanelPosition>1024</PanelPosition>
<WindowLoc>
<X>159</X>
<Y>35</Y>
</WindowLoc>
</Configuration>
Finally found a way to actual get Win 11 to reinstall .net Framework 4.8.1. However, that didn't fix anything. Still getting an error thrown from mscorlib.dll, ver 4.8.9181.0 dated 7/19/2023.
1. Delete the following folders from c:\windows\Microsoft.Net: Framework\v4.0.30319 and Framework64\v4.0.30319
2. Start a cmd prompt as an administrator
3. Run SFC /SCANNOW
4. Once it finishes, restart the computer and it will reinstall the missing files
I also uninstalled KSP2 and reinstalled it (via Steam). That didn't change anything other than I had to go install my favorite mods using the consoleui (seems to work without issue). Turned out, none of my mods were working before reinstalling KSP2. (Yep, KSP2 is still prerelease, expect to have to fix it often.)
Apparently there's a repair tool, might be worth a try:
https://www.microsoft.com/en-us/download/details.aspx?id=30135
Here's the code (specifically line 202) that calls the System.Xml
code that throws the exception, in case that helps you figure out what's wrong on your PC:
Yeah, don't do the things I have done. .Net is broken and just got Event Viewer to run again. Visual Studio 2022 will not run. Yep, I broke my machine....
Oh no! I hope you're able to recover it 🤞. Please let us know if you manage to figure out the problem with System.Xml
once you do...
Well, got Event Viewer working again. Fixed Visual Studio by restoring the backup I had of my .net framework folders. got the source from git for CKAN and thinking I will recompile for .Net 4.8.1 Framework (I actually do not have .Net 4.5 and 4.8 comes with Win 11).
Still can't compile anything Visual Studio is borked....
Ok, this is simiple to fix..
Now it appears to run without issue. Much beating my head against the wall over something simple to fix.
Glad you found a workaround! Please let us know if you ever discover what was actually wrong that made it necessary. As far as I know, no one else has ever needed to use that option before.
I was wrong, only seemed like it was going to work. Crashed soon after I selected my instance of KSP2 and now doesn't work. It still fails trying to write the GUIConfiguration even if I run it as administrator.
BTW, it is easy to change that app to not use the new terminal which should fix the issue about Terminal being left open (but your workaround of minimize works too).
Hey @PMoffitt05, sorry you've been having issues with this, but I don't think it's something we can solve for you. There's something weird on your system that's making a System
assembly throw internally when CKAN calls it in the most ordinary, boilerplate way. If you manage to identify something that CKAN is actually doing wrong here, we'll be happy to fix it, but for now I'm closing this.
Is there an existing issue for this?
Operating System
Windows 11 22H2
CKAN Version
1.33.2
Game Version
KSP2 0.1.4.1
Did you make any manual changes to your game folder (i.e., not via CKAN)?
Not that I am aware of.
Describe the bug
Deleting the CKAN folder or any of the files does not correct the issue.
Checking security settings, all users should have rights to the CKAN folder and contents.
Using ckan via CMD Terminal (command line version), I can list instances and clear them all. Then add in my current game instance and set it as default. But, the GUI or consoleui present the same issues afterwards. (Not an issue of not having a default game instance set.)
Renaming the CKAN folder and starting CKAN results in the same results.
Looking at the CKAN folder there is a registry.lock file when CKAN is running. Using consoleui, I can get an error that a registry lock file already exists when trying to selet the instance of the game I am playing and to check for other running versions of CKAN. However, this is the only running version. Seems to be an issue with CKAN checking for the registry lock file and finding it but not knowing it is its own lock file or not releasing (deleting) the lock when it should.
Steps to reproduce
Lunch CKAN by dubble clicking it.
Relevant log output
installed-KSP2.ckan:
registry.json: