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

When Chocolatey CLI v1.0.0 attempts to load Chocolatey Licensed Extension versions less than v4.0.0, it halts execution with an unclear and unhelpful error message #2656

Closed
gep13 opened this issue Mar 23, 2022 · 0 comments
Assignees
Milestone

Comments

@gep13
Copy link
Member

gep13 commented Mar 23, 2022

What You Are Seeing?

Executing choco.exe results in the following error:

The registered delegate for type IEnumerable threw an exception. Could not load type 'chocolatey.infrastructure.app.commands.ChocolateyVersionCommand' from assembly 'choco, Version=1.0.0.0, Culture=neutral, PublicKeyToken=79d02ea9cad655eb'.

Following the release of Chocolatey v1.0.0, there are two situations that are occurring that are causing problems, both of which relate to environments where the Chocolatey Licensed Extension is installed.

Chocolatey is upgraded first, before updating Chocolatey Licensed Extension

As documented in the release notes when upgrading to v1.0.0, if you are using Chocolatey Licensed Extension, you should first upgrade the chocolatey.extension package. This will ensure that all required dependencies are installed, including chocolatey itself.

If this process is not followed, there will be errors the next time choco is executed, since it will still be attempting to load the old Chocolatey Licensed Extension, which is no longer compatible, due to the commands that have been removed.

Once in this situation, it isn't possible to upgrade the chocolatey.extension package, since choco is essentially broken. There are steps to remediate this problem though, so if you are facing this, reach out to support.

Chocolatey is upgraded, when an older version of Chocolatey Licensed Extension is being used due to usage of Perpetual Chocolatey License

In this scenario, it isn't possible to first upgrade the chocolatey.extension package, as the customer doesn't have access to a new version.

What is Expected?

When upgrading Chocolatey, it should continue to work with older versions, so that follow up commands can be executed to upgrade the chocolatey.extension package, or allow usage of older package versions (perhaps with reduced functionality).

How Did You Get This To Happen? (Steps to Reproduce)

With Chocolatey CLI v0.12.1 installed and Chocolatey Licensed Extension v3.2.0 installed:

  1. Run choco upgrade chocolatey
  2. Run any Chocolatey command
  3. See the error mentioned above

Output Log

The registered delegate for type IEnumerable threw an exception. Could not load type 'chocolatey.infrastructure.app.commands.ChocolateyVersionCommand' from assembly 'choco, Version=1.0.0.0, Culture=neutral, PublicKeyToken=79d02ea9cad655eb'.

@gep13 gep13 added this to the 1.0.1 milestone Mar 23, 2022
@gep13 gep13 self-assigned this Mar 23, 2022
gep13 added a commit that referenced this issue Mar 23, 2022
This commit re-instates the ChocolateyVersionCommand and
ChocolateyUpdateCommand classes, however, it doesn't provide any
implementations for the methods within the ICommand interface.  In
addition, it also doesn't decorate the class with the CommandFor
attribute.

This has the effect that the commands still remain as unfound when
using Chocolatey CLI open source edition, however, it means that anyone
using an older version of the Chocolatey Licensed Extension (for
example perpetual licensed customers) will still have a basic
implementation of these commands that can be overridden.

The Exception that is thrown when one of the implemented methods is
executed is designed to match closely to the command not found error,
which is actually what we _want_ folks to see.

This change also has the side-effect of meaning that anyone directly
upgrading the chocolatey package, without first upgrading the
chocolatey.extension package, will no longer be broken after that
installation.
gep13 added a commit that referenced this issue Mar 23, 2022
So that when we look back on this, we will remember why these classes
were re-instated.
@gep13 gep13 changed the title TBD Chocolatey v1.0.0 doesn't work with version of the Chocolatey Licensed Extension less than v4.0.0 Mar 24, 2022
@gep13 gep13 changed the title Chocolatey v1.0.0 doesn't work with version of the Chocolatey Licensed Extension less than v4.0.0 Chocolatey v1.0.0 doesn't work with versions of the Chocolatey Licensed Extension less than v4.0.0 Mar 24, 2022
@gep13 gep13 changed the title Chocolatey v1.0.0 doesn't work with versions of the Chocolatey Licensed Extension less than v4.0.0 When Chocolatey CLI v1.0.0 attempts to load Chocolatey Licensed Extension versions less than v4.0.0, it halts execution with an unclear and unhelpful error message Mar 24, 2022
gep13 added a commit that referenced this issue Mar 24, 2022
* hotfix/1.0.1:
  (version) Ensure usage of build date
  (#2656) Add information to class
  (#2656) Re-instate the update and version commands
  (version) v1.0.1-beta
@gep13 gep13 closed this as completed Mar 24, 2022
gep13 added a commit that referenced this issue Mar 24, 2022
* master:
  (version) v1.0.1
  (version) Ensure usage of build date
  (#2656) Add information to class
  (#2656) Re-instate the update and version commands
  (version) v1.0.1-beta
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant