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

Prevent loading of Chocolatey GUI Licensed Extension assembly #2078

Closed
steviecoaster opened this issue Jul 7, 2020 · 4 comments · Fixed by #2230
Closed

Prevent loading of Chocolatey GUI Licensed Extension assembly #2078

steviecoaster opened this issue Jul 7, 2020 · 4 comments · Fixed by #2230
Assignees
Milestone

Comments

@steviecoaster
Copy link
Contributor

What You Are Seeing?

The following is logged as a warning when attempting to perform a choco install/upgrade/uninstall command:

WARNING: Import failed for 'C:\ProgramData\chocolatey\extensions\chocolateygui\chocolateygui.licensed.dll'.  Error: 'Could not load file or assembly 'Autofac, Version=4.6.1.0, Culture=neutral, PublicKeyToken=17863af14b0044da' or one of its dependencies. The system cannot find the file specified.'

What is Expected?

That the ChocolateyGui extension DLL is skipped when choco imports all of the extension modules it currently has installed on the system, as it is not actually a PowerShell Module that needs to be imported into the session

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

  1. Install ChocolateyGUI 0.17+
  2. Installed licensed package chocolateygui.extension
  3. Perform any install/upgrade/uninstall operation

Output Log

See 'What Are You Seeing' section

@steviecoaster steviecoaster added this to the 0.10.16 milestone Jul 7, 2020
@ferventcoder
Copy link
Member

Yes it does. @gep13 knows about this as well.

@ferventcoder
Copy link
Member

Chocolatey is doing exactly what it was designed to do here, load extensions. We either need to move the gui extension to some other mechanism, have it work by finding the assemblies it needs, or add an exclusion specifically for this in choco. It seems we were leaning towards the latter when we last discussed this

@steviecoaster
Copy link
Contributor Author

or add an exclusion specifically for this in choco

This was the conclusion I got when I discussed it with @gep13 earlier today.

@gep13 gep13 self-assigned this Apr 14, 2021
gep13 added a commit to gep13/choco that referenced this issue Apr 14, 2021
The Chocolatey GUI Extension is a "special" extension in the sense that
it isn't intended to work with Chocolatey directly, but it is shipped as
a "normal" Chocolatey extension. We don't want to load the
chocolateygui.licensed.dll into the choco.exe process, but rather leave
it alone, and allow Chocolatey GUI to load it when required.

We are already skipping one existing folder when looking for extension
paths, so this has been extended to include the chocolateygui foler.
gep13 added a commit to gep13/choco that referenced this issue Apr 14, 2021
The Chocolatey GUI Extension is a "special" extension in the sense that
it isn't intended to work with Chocolatey directly, but it is shipped as
a "normal" Chocolatey extension. We don't want to load the
chocolateygui.licensed.dll into the choco.exe process, but rather leave
it alone, and allow Chocolatey GUI to load it when required.
gep13 added a commit to gep13/choco that referenced this issue Apr 16, 2021
The Chocolatey GUI Extension is a "special" extension in the sense that
it isn't intended to work with Chocolatey directly, but it is shipped as
a "normal" Chocolatey extension. We don't want to load the
chocolateygui.licensed.dll into the choco.exe process, but rather leave
it alone, and allow Chocolatey GUI to load it when required.
gep13 added a commit that referenced this issue Apr 16, 2021
(#2078) Skip importing Chocolatey GUI Extension
@gep13 gep13 closed this as completed Apr 16, 2021
gep13 added a commit that referenced this issue Apr 19, 2021
* stable:
  (#1861) Improves terminology in help documentation
  (#1998) Add authorization header to Get-WebFile
  (maint) Repalce RawGit with raw.githack.com CDN
  (#1899) Remove unused variables
  (GH-1060) Add BeforeInstall parameter to Install-ChocolateyPackage.ps1
  (maint) Improve log message
  (GH-2092) Take all registry keys into account
  (GH-1364) Template create .nuspec encoded without BOM
  (#1866) Limit pending package removal to top level
  (GH-2203) Get-ChocolateyUnzip add unzipLocation alias
  (GH-1889) Fix: Removal of ApiKey broken
  (#2114) Remove unused variable
  (GH-2048) update deprecation note to outdated
  (maint) Spelling and grammar fixes
  (maint) Replace tabs with spaces
  (#2078) Skip importing Chocolatey GUI Extension
  (#2227) Use latest Mono and Ubuntu on Travis
steviecoaster added a commit to steviecoaster/choco that referenced this issue May 11, 2021
…GH2112

* 'GH2112' of https://github.com/steviecoaster/choco:
  (chocolatey#2112) Add msp support to Install helper
  (maint) Switch to using a Regex match
  (maint) Change formatting
  (maint) Remove use of PowerShell aliases
  (maint) Replace " with '
  (chocolatey#2044) Fix for changing $env:Temp
  (chocolatey#2259) Switched to versioned NuGet.Core
  (chocolatey#2111) Deep copy config
  (chocolatey#2244) Add Mac build into main workflow
  (chocolatey#2238) Mono build don't hardcode xbuild path
  (maint) Fix artifact paths on AppVeyor
  (chocolatey#2244) Fix syntax for running on Windows
  (chocolatey#2244) Initial workflow for Windows and Ubuntu
  (doc) Remove Mono instructions for other distributions
  (doc) Add Ubuntu 20.04 mono install instructions
  (chocolatey#2227) Bump Mono version in Dockerfile and README
  (chocolatey#2236) Mono test work with merged usr systems
  (chocolatey#2190) Clarify help for SpecificFolder parameter
  (chocolatey#1962) Use different message on error
  (chocolatey#1861) Improves terminology in help documentation
  (chocolatey#1998) Add authorization header to Get-WebFile
  (maint) Repalce RawGit with raw.githack.com CDN
  (chocolatey#1899) Remove unused variables
  (chocolateyGH-1060) Add BeforeInstall parameter to Install-ChocolateyPackage.ps1
  (maint) Improve log message
  (chocolateyGH-2092) Take all registry keys into account
  (chocolateyGH-1364) Template create .nuspec encoded without BOM
  (chocolatey#1866) Limit pending package removal to top level
  (chocolateyGH-2203) Get-ChocolateyUnzip add unzipLocation alias
  (chocolateyGH-1889) Fix: Removal of ApiKey broken
  (chocolatey#2114) Remove unused variable
  (chocolateyGH-2048) update deprecation note to outdated
  (maint) Spelling and grammar fixes
  (maint) Replace tabs with spaces
  (chocolatey#2078) Skip importing Chocolatey GUI Extension
  (chocolatey#2227) Use latest Mono and Ubuntu on Travis
  (chocolatey#2205) Remove mention of private repository
  (chocolatey#2205) Update remaining URLs to new location
  (maint) Remove unnecessary whitespace
  (chocolatey#2231) Change default repository URL
  (maint) Remove unnecessary whitespace
  (chocolatey#2205) Update all chocolatey.org/docs URLs
  (maint) Remove unnecessary whitespace
  (chocolatey#2205) Update automatic-packages docs links
  (doc) Update to prefer # rather than GH-
  (maint) Fix replacement
  (maint) Revert change to earlier commit
  (maint) Fix spelling mistake
  (maint) Fix spelling mistake
  (doc) Update script to Statiq format
  (maint) Add missing backtick in example
  (maint) Added explicit link to new function name
  (maint) Fix spelling mistake
  (maint) Fix spelling mistake
  (maint) Fix spelling mistake
  (maint) Fix spelling mistake
  (maint) Fix spelling mistake
  (maint) Fix spelling mistake
  (maint) Remove generated docs files
  (maint) Add docs/generated folder to ignore list
  (chocolateyGH-2105) Update link to Chocolatey workshop
@gep13 gep13 changed the title choco improperly attempts to load a DLL when Licensed ChocolateyGUI extension is installed Prevent loading of Chocolatey GUI Licensed Extension assembly May 18, 2021
@ferventcoder
Copy link
Member

Related to #1041

vexx32 pushed a commit to vexx32/choco that referenced this issue Aug 30, 2021
As there isn't a way to determine whether a DLL is a usable PowerShell
module without loading it into memory, we're better off not loading DLLs
directly, as it has caused issues several times in the past
(see: chocolatey#2078, chocolatey#1041).
This has previously required us to create an ever-expanding list of
exceptions to the loading behaviour.

Instead, if folks want to load DLLs as powershell modules, they can
package them alongside a PSM1 file that handles the DLL import itself.
This removes the need for Chocolatey to guess which dlls are powershell
modules and which should not be loaded.
gep13 pushed a commit to vexx32/choco that referenced this issue Sep 2, 2021
As there isn't a way to determine whether a DLL is a usable PowerShell
module without loading it into memory, we're better off not loading DLLs
directly, as it has caused issues several times in the past
(see: chocolatey#2078, chocolatey#1041).
This has previously required us to create an ever-expanding list of
exceptions to the loading behaviour.

Instead, if folks want to load DLLs as powershell modules, they can
package them alongside a PSM1 file that handles the DLL import itself.
This removes the need for Chocolatey to guess which dlls are powershell
modules and which should not be loaded.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants