Skip to content
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

Null reference exception is thrown when accessing the Chocolatey GUI settings screen #1003

Closed
4 tasks done
mattgyver-it opened this issue May 31, 2023 · 6 comments · Fixed by #1010
Closed
4 tasks done
Assignees
Labels
5 - Released The issue has been resolved, and released to the public for consumption Bug Issues where something has happened which was not expected or intended
Milestone

Comments

@mattgyver-it
Copy link

Checklist

  • I have verified this is the correct repository for opening this issue.
  • I have verified no other issues exist related to my problem.
  • I have verified this is not an issue for a specific package.
  • I have verified this issue is not security related.

What You Are Seeing?

I just did a fresh install of Chocolatey 2.0.0 through powershell on Win 10 Home as an OSS user. I installed the ChocolateyGUI package. When I open ChocolateyGUI as admin, and click on Settings, it immediately throws the following NullException and then crashes.
Screenshot 2023-05-31 072129

What is Expected?

I expected to see the settings menu

How Did You Get This To Happen?

  1. Open ChocolateyGUI
  2. Click Settings

System Details

  • Operating System: 10.0.19045.0
  • Windows PowerShell version: 5.1.19041.2673
  • Chocolatey CLI Version: 2.0.0
  • Chocolatey Licensed Extension version: Chocolatey v2.0.0
  • Chocolatey License type: open source / free
  • Terminal/Emulator: Powershell

Installed Packages

-lo is invalid

Chocolatey v2.0.0
7zip.install 22.1.0
adobereader 2023.1.20143
chocolatey 2.0.0
chocolatey-compatibility.extension 1.0.0
chocolatey-core.extension 1.4.0
chocolatey-dotnetfx.extension 1.0.1
chocolateygui 2.0.0
dotnetfx 4.8.0.20220524
KB2919355 1.0.20160915
KB2919442 1.0.20160915
notepadplusplus.install 8.5.3
11 packages installed.

Output Log

2023-05-31 07:18:49.608 -07:00 [Information] [NuGet]   GET https://community.chocolatey.org/api/v2/Search()/$count?$filter=IsLatestVersion&$orderby=DownloadCount desc,Id&searchTerm=''&targetFramework=''&includePrerelease=false&semVerLevel=2.0.0
2023-05-31 07:18:49.729 -07:00 [Information] [NuGet]   OK https://community.chocolatey.org/api/v2/Search()/$count?$filter=IsLatestVersion&$orderby=DownloadCount desc,Id&searchTerm=''&targetFramework=''&includePrerelease=false&semVerLevel=2.0.0 117ms
2023-05-31 07:19:57.506 -07:00 [Fatal] Unhandled Exception
2023-05-31 07:45:48.683 -07:00 [Information] chocolatey - https://community.chocolatey.org/api/v2/ | Priority 0|Bypass Proxy - False|Self-Service - False|Admin Only - False.
2023-05-31 07:45:59.752 -07:00 [Fatal] Unhandled Exception
2023-05-31 07:49:22.924 -07:00 [Information] chocolatey - https://community.chocolatey.org/api/v2/ | Priority 0|Bypass Proxy - False|Self-Service - False|Admin Only - False.
2023-05-31 07:49:27.112 -07:00 [Fatal] Unhandled Exception
2023-05-31 07:52:33.609 -07:00 [Information] chocolatey - https://community.chocolatey.org/api/v2/ | Priority 0|Bypass Proxy - False|Self-Service - False|Admin Only - False.
2023-05-31 07:52:42.332 -07:00 [Information] [NuGet] Enhanced retry: HttpRetryHandler is in a state that retry would have been abandoned or not waited if it were not enabled.
2023-05-31 07:52:43.383 -07:00 [Information] [NuGet]   GET https://community.chocolatey.org/api/v2/Search()?$filter=IsLatestVersion&$orderby=DownloadCount desc,Id&searchTerm=''&targetFramework=''&includePrerelease=false&$skip=0&$top=30&semVerLevel=2.0.0
2023-05-31 07:52:43.475 -07:00 [Information] [NuGet]   OK https://community.chocolatey.org/api/v2/Search()?$filter=IsLatestVersion&$orderby=DownloadCount desc,Id&searchTerm=''&targetFramework=''&includePrerelease=false&$skip=0&$top=30&semVerLevel=2.0.0 88ms
2023-05-31 07:52:43.603 -07:00 [Information] [NuGet] Enhanced retry: HttpRetryHandler is in a state that retry would have been abandoned or not waited if it were not enabled.
2023-05-31 07:52:44.712 -07:00 [Information] [NuGet]   GET https://community.chocolatey.org/api/v2/Search()?$filter=IsLatestVersion&$orderby=DownloadCount desc,Id&searchTerm=''&targetFramework=''&includePrerelease=false&$skip=30&$top=20&semVerLevel=2.0.0
2023-05-31 07:52:44.792 -07:00 [Information] [NuGet]   OK https://community.chocolatey.org/api/v2/Search()?$filter=IsLatestVersion&$orderby=DownloadCount desc,Id&searchTerm=''&targetFramework=''&includePrerelease=false&$skip=30&$top=20&semVerLevel=2.0.0 77ms
2023-05-31 07:52:45.076 -07:00 [Information] [NuGet]   GET https://community.chocolatey.org/api/v2/Search()/$count?$filter=IsLatestVersion&$orderby=DownloadCount desc,Id&searchTerm=''&targetFramework=''&includePrerelease=false&semVerLevel=2.0.0
2023-05-31 07:52:45.147 -07:00 [Information] [NuGet]   OK https://community.chocolatey.org/api/v2/Search()/$count?$filter=IsLatestVersion&$orderby=DownloadCount desc,Id&searchTerm=''&targetFramework=''&includePrerelease=false&semVerLevel=2.0.0 69ms
2023-05-31 07:53:00.634 -07:00 [Information] [NuGet] Enhanced retry: HttpRetryHandler is in a state that retry would have been abandoned or not waited if it were not enabled.
2023-05-31 07:53:01.645 -07:00 [Information] [NuGet]   GET https://community.chocolatey.org/api/v2/Search()?$filter=IsLatestVersion&$orderby=DownloadCount desc,Id&searchTerm='chocolatey'&targetFramework=''&includePrerelease=false&$skip=0&$top=30&semVerLevel=2.0.0
2023-05-31 07:53:01.871 -07:00 [Information] [NuGet]   OK https://community.chocolatey.org/api/v2/Search()?$filter=IsLatestVersion&$orderby=DownloadCount desc,Id&searchTerm='chocolatey'&targetFramework=''&includePrerelease=false&$skip=0&$top=30&semVerLevel=2.0.0 223ms
2023-05-31 07:53:01.976 -07:00 [Information] [NuGet] Enhanced retry: HttpRetryHandler is in a state that retry would have been abandoned or not waited if it were not enabled.
2023-05-31 07:53:03.124 -07:00 [Information] [NuGet]   GET https://community.chocolatey.org/api/v2/Search()?$filter=IsLatestVersion&$orderby=DownloadCount desc,Id&searchTerm='chocolatey'&targetFramework=''&includePrerelease=false&$skip=30&$top=20&semVerLevel=2.0.0
2023-05-31 07:53:03.369 -07:00 [Information] [NuGet]   OK https://community.chocolatey.org/api/v2/Search()?$filter=IsLatestVersion&$orderby=DownloadCount desc,Id&searchTerm='chocolatey'&targetFramework=''&includePrerelease=false&$skip=30&$top=20&semVerLevel=2.0.0 242ms
2023-05-31 07:53:03.508 -07:00 [Information] [NuGet]   GET https://community.chocolatey.org/api/v2/Search()/$count?$filter=IsLatestVersion&$orderby=DownloadCount desc,Id&searchTerm='chocolatey'&targetFramework=''&includePrerelease=false&semVerLevel=2.0.0
2023-05-31 07:53:03.734 -07:00 [Information] [NuGet]   OK https://community.chocolatey.org/api/v2/Search()/$count?$filter=IsLatestVersion&$orderby=DownloadCount desc,Id&searchTerm='chocolatey'&targetFramework=''&includePrerelease=false&semVerLevel=2.0.0 225ms
2023-05-31 07:53:23.243 -07:00 [Information] [NuGet] Enhanced retry: HttpRetryHandler is in a state that retry would have been abandoned or not waited if it were not enabled.
2023-05-31 07:53:24.357 -07:00 [Information] [NuGet]   GET https://community.chocolatey.org/api/v2/Search()?$filter=IsLatestVersion&$orderby=DownloadCount desc,Id&searchTerm='chocolatey'&targetFramework=''&includePrerelease=false&$skip=0&$top=30&semVerLevel=2.0.0
2023-05-31 07:53:24.437 -07:00 [Information] [NuGet]   OK https://community.chocolatey.org/api/v2/Search()?$filter=IsLatestVersion&$orderby=DownloadCount desc,Id&searchTerm='chocolatey'&targetFramework=''&includePrerelease=false&$skip=0&$top=30&semVerLevel=2.0.0 78ms
2023-05-31 07:53:24.537 -07:00 [Information] [NuGet] Enhanced retry: HttpRetryHandler is in a state that retry would have been abandoned or not waited if it were not enabled.
2023-05-31 07:53:25.570 -07:00 [Information] [NuGet]   GET https://community.chocolatey.org/api/v2/Search()?$filter=IsLatestVersion&$orderby=DownloadCount desc,Id&searchTerm='chocolatey'&targetFramework=''&includePrerelease=false&$skip=30&$top=20&semVerLevel=2.0.0
2023-05-31 07:53:25.643 -07:00 [Information] [NuGet]   OK https://community.chocolatey.org/api/v2/Search()?$filter=IsLatestVersion&$orderby=DownloadCount desc,Id&searchTerm='chocolatey'&targetFramework=''&includePrerelease=false&$skip=30&$top=20&semVerLevel=2.0.0 70ms
2023-05-31 07:53:25.757 -07:00 [Information] [NuGet]   GET https://community.chocolatey.org/api/v2/Search()/$count?$filter=IsLatestVersion&$orderby=DownloadCount desc,Id&searchTerm='chocolatey'&targetFramework=''&includePrerelease=false&semVerLevel=2.0.0
2023-05-31 07:53:25.824 -07:00 [Information] [NuGet]   OK https://community.chocolatey.org/api/v2/Search()/$count?$filter=IsLatestVersion&$orderby=DownloadCount desc,Id&searchTerm='chocolatey'&targetFramework=''&includePrerelease=false&semVerLevel=2.0.0 65ms
2023-05-31 07:53:43.633 -07:00 [Fatal] Unhandled Exception
2023-05-31 08:06:26.524 -07:00 [Information] chocolatey - https://community.chocolatey.org/api/v2/ | Priority 0|Bypass Proxy - False|Self-Service - False|Admin Only - False.
2023-05-31 08:06:30.382 -07:00 [Fatal] Unhandled Exception

Additional Context

No response

@mattgyver-it mattgyver-it added the Bug Issues where something has happened which was not expected or intended label May 31, 2023
@pauby
Copy link
Member

pauby commented May 31, 2023

I am able to reproduce this issue.

@pauby pauby added the 0 - _Triaging Issue is accepted, but a milestone has yet to be added for the issue label May 31, 2023
@pauby pauby added this to the vNext milestone May 31, 2023
@gep13 gep13 changed the title ChocolateyGUI Settings throw NullException Chocolatey GUI Settings throw NullException Jun 5, 2023
@gep13 gep13 added 0 - Backlog Issue is accepted, but is not ready to be worked on or not in current sprint and removed 0 - _Triaging Issue is accepted, but a milestone has yet to be added for the issue labels Jun 5, 2023
@gep13 gep13 modified the milestones: vNext, 2.0.1 Jun 5, 2023
@AdmiringWorm AdmiringWorm self-assigned this Jun 7, 2023
@AdmiringWorm AdmiringWorm added 2 - Working A user or team member has started working on the issue and removed 0 - Backlog Issue is accepted, but is not ready to be worked on or not in current sprint labels Jun 7, 2023
AdmiringWorm added a commit to AdmiringWorm/ChocolateyGUI that referenced this issue Jun 7, 2023
The helper class that is used whe looking up any translations that has
been made did not handle the translation source strings when they
are null or empty. This causes problems when especially looking up
description of Chocolatey settings items that by some reason did
not have a description associated with themself in the configuration
file.
@AdmiringWorm AdmiringWorm added 3 - Review Code has been added, and is available for review as a pull request and removed 2 - Working A user or team member has started working on the issue labels Jun 7, 2023
gep13 added a commit that referenced this issue Jun 7, 2023
(#1003) Handle null keys during source translation
@gep13 gep13 added 4 - Done Code has been added to the repository, and has been reviewed by a team member and removed 3 - Review Code has been added, and is available for review as a pull request labels Jun 7, 2023
@gep13 gep13 changed the title Chocolatey GUI Settings throw NullException Null reference exception is thrown when accessing the Chocolatey GUI settings screen Jun 8, 2023
@gep13
Copy link
Member

gep13 commented Jun 9, 2023

A new version of Chocolatey GUI (v2.1.0-alpha-20230608) has been released which aims to address this issue. You can find the release notes here:

https://docs.chocolatey.org/en-us/chocolatey-gui/release-notes#alpha-20230608-june-8-2023

And the package here:

https://community.chocolatey.org/packages/chocolateygui/2.1.0-alpha-20230608

You should be able to upgrade to this package version using:

choco upgrade chocolateygui --pre

If you could take this for a spin, and verify that the issue is now resolved, that would be very helpful.

@mattgyver-it
Copy link
Author

mattgyver-it commented Jun 9, 2023 via email

@gep13
Copy link
Member

gep13 commented Jun 9, 2023

@mattgyver-it thank you for confirming!

@IT-Apkl
Copy link

IT-Apkl commented Jun 20, 2023

Had the same issue but couldn't find this report. Adding keywords to make this issue easier to find.

Keywords:

  • System.ArgumentNullException
  • System.Resources.ResourceManager.GetString
  • Parameter name: name

gep13 added a commit to gep13/choco that referenced this issue Jun 22, 2023
Previously, in this commit:

chocolatey@da19356#diff-cb6a0471e41268b22a928bd57a59d51b70b7024e9beb30e89a330e193a089eba

The usage of the top level CacheLocation and
CommandExecutionTimeoutSeconds values had been removed, since these top
level properties within the chocolatey.config had been replaced with
values contained within the config section of the chocolatey.config
file.

However, the changes in that commit were too aggressive, and removed
the call to the set_config_item (which has subsequently been renamed to
SetConfigItem).  The method call does the work of taking any value that
is defined in the chocolatey.config for a given property name, and
adding it to the ChocolateyConfiguration instance.  When this method
call was removed, it stopped setting the property value on the
instance, and as a result, values that had been configured in the
chocolatey.config file were ignored.  They were still in play when the
configuration was passed in via a command line option, but not when
defining them in the chocolatey.config file.

The removal of this call to the set_config_item method also explains
why it was necessary to apply this bug fix in Chocolatey GUI:

chocolatey/ChocolateyGUI#1003

The method call also had the effect of setting the description on the
configuration value, which would have meant that Chocolatey GUI
wouldn't have thrown a null reference exception.  The change in
Chocolatey GUI is still valid though, as there are times when a config
value can have a missing description, so it makes sense to leave that
fix in place.
gep13 added a commit to gep13/choco that referenced this issue Jun 23, 2023
Previously, in this commit:

chocolatey@da19356#diff-cb6a0471e41268b22a928bd57a59d51b70b7024e9beb30e89a330e193a089eba

The usage of the top level CacheLocation and
CommandExecutionTimeoutSeconds values had been removed, since these top
level properties within the chocolatey.config had been replaced with
values contained within the config section of the chocolatey.config
file.

However, the changes in that commit were too aggressive, and removed
the call to the set_config_item (which has subsequently been renamed to
SetConfigItem).  The method call does the work of taking any value that
is defined in the chocolatey.config for a given property name, and
adding it to the ChocolateyConfiguration instance.  When this method
call was removed, it stopped setting the property value on the
instance, and as a result, values that had been configured in the
chocolatey.config file were ignored.  They were still in play when the
configuration was passed in via a command line option, but not when
defining them in the chocolatey.config file.

The removal of this call to the set_config_item method also explains
why it was necessary to apply this bug fix in Chocolatey GUI:

chocolatey/ChocolateyGUI#1003

The method call also had the effect of setting the description on the
configuration value, which would have meant that Chocolatey GUI
wouldn't have thrown a null reference exception.  The change in
Chocolatey GUI is still valid though, as there are times when a config
value can have a missing description, so it makes sense to leave that
fix in place.
gep13 added a commit to gep13/choco that referenced this issue Jun 23, 2023
Previously, in this commit:

chocolatey@da19356#diff-cb6a0471e41268b22a928bd57a59d51b70b7024e9beb30e89a330e193a089eba

The usage of the top level CacheLocation and
CommandExecutionTimeoutSeconds values had been removed, since these top
level properties within the chocolatey.config had been replaced with
values contained within the config section of the chocolatey.config
file.

However, the changes in that commit were too aggressive, and removed
the call to the set_config_item (which has subsequently been renamed to
SetConfigItem).  The method call does the work of taking any value that
is defined in the chocolatey.config for a given property name, and
adding it to the ChocolateyConfiguration instance.  When this method
call was removed, it stopped setting the property value on the
instance, and as a result, values that had been configured in the
chocolatey.config file were ignored.  They were still in play when the
configuration was passed in via a command line option, but not when
defining them in the chocolatey.config file.

The removal of this call to the set_config_item method also explains
why it was necessary to apply this bug fix in Chocolatey GUI:

chocolatey/ChocolateyGUI#1003

The method call also had the effect of setting the description on the
configuration value, which would have meant that Chocolatey GUI
wouldn't have thrown a null reference exception.  The change in
Chocolatey GUI is still valid though, as there are times when a config
value can have a missing description, so it makes sense to leave that
fix in place.
corbob pushed a commit to gep13/choco that referenced this issue Jun 23, 2023
Previously, in this commit:

chocolatey@da19356#diff-cb6a0471e41268b22a928bd57a59d51b70b7024e9beb30e89a330e193a089eba

The usage of the top level CacheLocation and
CommandExecutionTimeoutSeconds values had been removed, since these top
level properties within the chocolatey.config had been replaced with
values contained within the config section of the chocolatey.config
file.

However, the changes in that commit were too aggressive, and removed
the call to the set_config_item (which has subsequently been renamed to
SetConfigItem).  The method call does the work of taking any value that
is defined in the chocolatey.config for a given property name, and
adding it to the ChocolateyConfiguration instance.  When this method
call was removed, it stopped setting the property value on the
instance, and as a result, values that had been configured in the
chocolatey.config file were ignored.  They were still in play when the
configuration was passed in via a command line option, but not when
defining them in the chocolatey.config file.

The removal of this call to the set_config_item method also explains
why it was necessary to apply this bug fix in Chocolatey GUI:

chocolatey/ChocolateyGUI#1003

The method call also had the effect of setting the description on the
configuration value, which would have meant that Chocolatey GUI
wouldn't have thrown a null reference exception.  The change in
Chocolatey GUI is still valid though, as there are times when a config
value can have a missing description, so it makes sense to leave that
fix in place.
gep13 added a commit that referenced this issue Jun 29, 2023
* release/2.1.0:
  (maint) Update to latest version of chocolatey.lib
  (maint) Update GRM configuration file
  (maint) Remove version bump in nuspec file
  (build) Use latest Chocolatey.Cake.Recipe package
  (maint) Switch to Http for variable names
  (#1014) Add advanced option to ignore cached items
  (#1014) Ignore cached files on forced outdated check
  (build) Make build files consistent with others
  (#993) (fix) Correct syntax in KTS file
  (#993) Add TC schedule trigger
  (maint) Fix StyleCop warnings
  (#980) Use assembly location when debugging
  (maint) Update to released alpha package
  (#1003) Handle null keys during source translation
  (#1005) Normalize version numbers
  (maint) Add banned api analyzer
  (maint) Remove usage of obsolete methods
  (maint) Update to latest Chocolatey.Lib package
@gep13 gep13 added 5 - Released The issue has been resolved, and released to the public for consumption and removed 4 - Done Code has been added to the repository, and has been reviewed by a team member labels Jun 29, 2023
@choco-bot
Copy link

🎉 This issue has been resolved in version 2.1.0 🎉

The release is available on:

Your GitReleaseManager bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
5 - Released The issue has been resolved, and released to the public for consumption Bug Issues where something has happened which was not expected or intended
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants