chocolatey / ChocolateyGUI

A delicious GUI for Chocolatey
https://docs.chocolatey.org/en-us/chocolatey-gui/
Apache License 2.0
1.65k stars 251 forks source link

Crash on start - unhandled exception #944

Open OzWT opened 2 years ago

OzWT commented 2 years ago

When I start ChocolateyGUI, I get an unhandled exception error from Windows.

My system: Windows 10 Pro 21H1 (32 bit) Build 19043.1706 Chocolatey version 1.1.0 ChocolateyGUI version 1.0.0

Screenshot below. Fehler

The debug log from ChocolateyGUI is here.

I have reinstalled ChocolateyGUI and I tried to delete the %appdata%\Local\Chocolatey Gui\data.db, but it doesnt help.

fenderfan7 commented 2 years ago

I get a very similar crash on startup, reinstalling does not help here as well. ChocolateyCrash

corbob commented 2 years ago

IIRC the only xml file read in by Chocolatey GUI is the Chocolatey Configuration file found at $env:ChocolateyInstall/config/chocolatey.config. @fenderfan7 the error you have there appears to indicate an invalid character as the first character of the Chocolatey config file. Interestingly it sounds like you're not having Chocolatey issues even though it appears to only be Chocolatey methods mentioned as opposed to Chocolatey GUI.

I would check what encoding the chocolatey.config has, and ensure it's saved as UTF8 without BOM if it's not already.

fenderfan7 commented 2 years ago

@corbob Yes my chocolatey kept working fine. I found the solution: The outdatedPackages.xml file was invalid. I just renamed the file under [Username]\AppData\Local\Chocolatey GUI and restarted chocolatey gui and everything is fine now.

This corrupted file must have been written, when my PC shut down immediately (probably due to some unrelated driver failure) yesterday while the file was written.

Here is an upload of the broken file, if anybody wants to debug this. outdatedPackagesBroken.zip

corbob commented 2 years ago

Thank you for getting us the file @fenderfan7! It looks like you're right, it was corrupted. I had to open it in a hex editor to see anything with it, and it was all just 0's:

image

@OzWT if you're still having this issue, could you verify that particular xml file? As well, the error seems to indicate some NuGet related things, can you verify that choco list -lo functions correctly?

OzWT commented 2 years ago

Yes I still have this issue, but only on the system described in the 1. Post. On my other machines (64 bit) I haven't an issue with Chocolatey GUI (maybe the architecture matters).

Concerning the system with the issue: I don't have the outdatedPackages.xml file in the [Username]\AppData\Local\Chocolatey GUI folder. I think it is created after a proper start of Chocolatey GUI.

Chocolatey (cli) works as expected all the time. choco list -lo lists all installed packages without an error.

After @corbob mentioned the $env:ChocolateyInstall/config/chocolatey.config, I experimented a bit with the chocolatey.config. This file is encoded as UTF-8-BOM. If I change this into UTF-8 without BOM, Chocolatey GUI still crashes and chocolatey.config is encoded as UTF-8-BOM again. If I change the encoding and set a write protection, Chocolatey GUI takes much longer till crash.

corbob commented 2 years ago

Thank you for the additional information @OzWT. It sounds like it's related to the chocolatey.config file as you say it takes longer before it crashes when it's not allowed to write to it. Could you possibly rename or move the file and try again? If it works after renaming/moving the file, I'd love to see the file, but beware that it could contain sensitive data so you may not want to upload it without verifying it's contents.

As for the issue @fenderfan7 ran into, I'll open a new issue for that so we can hopefully add some handling of corruption in the outdatedPackages.xml file 😄

OzWT commented 2 years ago

It doesn't work. The error massage (translated from German): The application could not be started. the file 'ChocolateyInstall/config/chocolatey.config' could not be found.

Sad, but let me know, if I can some other tests for you.