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

Get-AppxPackage not working when using Install-BoxstarterPackage #582

Open
6 tasks done
talha5389-teraception opened this issue Oct 21, 2024 · 0 comments
Open
6 tasks done
Labels
Bug Issues where something has happened which was not expected or intended

Comments

@talha5389-teraception
Copy link

talha5389-teraception commented Oct 21, 2024

Checklist

  • I confirm there are no unresolved issues reported on the Chocolatey Status page.
  • 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.
  • I confirm I am using official, and not unofficial, or modified, Chocolatey products.

What You Are Seeing?

I am invoking a script via Install-BoxstarterPackage from within BoxstarterShell in Windows-11 24h2. The script contains usage of Get-AppxPackage module to find packaged windows apps.

This is giving ERROR: The type initializer for '<Module>' threw an exception.. If I use this command Get-AppxPackage directly in powershell or Boxstarter shell it works correctly. It only gives above error when invoked via Install-BoxstarterPackage from within BoxstarterShell

I have confirmed that it seems to happen with Windows 11 24H2. It is working fine in Windows 11 23H2.

What is Expected?

Command to work normally in script being invoked by Install-BoxstarterPackage

How Did You Get This To Happen?

  1. Create a script with following content in file called script.ps1
echo "here"
Get-AppxPackage
echo "here2"
  1. Enter boxstartershell by typing BoxStarterShell.bat
  2. Run Install-BoxstarterPackage .\script.ps1

System Details

  • Operating System: Windows 11 24h2
  • Windows PowerShell version: 5.1.26100 rev 1882
  • Chocolatey CLI Version: 2.3.0
  • Chocolatey Licensed Extension version:
  • Chocolatey License type:
  • Terminal/Emulator: Powershell
  • Boxstarter version: 3.0.3

Installed Packages

tmp* packages in below list are all other that are installed as part of my automation script. This command Get-AppxPackage is also part of them. It used to work correctly few months ago. Not sure other than 24h2, if anything else has changed that caused it e.g. boxstarter version

7zip.install 24.8.0
bitwarden 2024.9.0
Boxstarter 3.0.3
Boxstarter.Bootstrapper 3.0.3
Boxstarter.Chocolatey 3.0.3
Boxstarter.Common 3.0.3
Boxstarter.HyperV 3.0.3
Boxstarter.WinConfig 3.0.3
chocolatey 2.3.0
chocolatey-compatibility.extension 1.0.0
chocolatey-core.extension 1.4.0
chocolatey-dotnetfx.extension 1.0.1
chocolatey-font-helpers.extension 0.0.4
chocolatey-visualstudio.extension 1.11.1
chocolatey-windowsupdate.extension 1.0.5
cmake 3.30.5
cmake.install 3.30.5
composer 6.3.0
cyberduck 9.0.3.42112
dbeaver 24.2.2
DotNet4.5.2 4.5.2.20140902
dotnet4.7.1 4.7.2558.20190226
dotnetfx 4.8.0.20220524
duck 9.0.2.42108
FiraCode 6.2.0
Firefox 131.0.3
git 2.47.0
git.install 2.47.0
GoogleChrome 130.0.6723.59
KB2919355 1.0.20160915
KB2919442 1.0.20160915
KB2999226 1.0.20181019
KB3033929 1.0.5
KB3035131 1.0.3
microsoft-teams-new-bootstrapper 1.0.2414501
mkcert 1.4.4
mongodb-compass 1.44.5
mongodb-database-tools 100.10.0
mongodb-shell 2.3.2
ngrok 3.17.0
notepadplusplus 8.7.0
notepadplusplus.install 8.7.0
openvpn-connect 3.5.1
php 8.3.12
putty 0.81.0
putty.portable 0.81.0
pyenv-win 3.1.1
slack 4.40.133
sourcetree 3.4.18
tailscale 1.74.0
tmp7A9D.tmp 1.0.0
tmpC96B.tmp 1.0.0
tmpC9E7.tmp 1.0.0
tmpD081.tmp 1.0.0
tmpD798.tmp 1.0.0
tmpE6BF.tmp 1.0.0
vcredist140 14.40.33816
vcredist2005 8.0.50727.619501
vcredist2008 9.0.30729.616104
vcredist2010 10.0.40219.32503
vcredist2012 11.0.61031.20230518
vcredist2013 12.0.40660.20180427
vcredist2015 14.0.24215.20170201
visualcpp-build-tools 15.0.26228.20170424
visualstudio2022buildtools 117.11.5
visualstudio-installer 2.0.3
vlc 3.0.21
vlc.install 3.0.21
volta 1.1.1
vscode 1.94.2
vscode.install 1.94.2

Output Log

Contents of .\tools\ChocolatelyInstall.ps1

echo "here"
Get-AppxPackage
echo "here2"

Output it produced

Boxstarter: Installing package .\tools\ChocolateyInstall.ps1
Boxstarter Version 3.0.3.0
(c) 2018 Chocolatey Software, Inc, 2012 - 2018 Matt Wrock. https://boxstarter.org

Boxstarter: Disabling Automatic Updates from Windows Update
Chocolatey v2.3.0
Attempting to build package from 'tmp6132.tmp.nuspec'.
Successfully created package 'C:\ProgramData\Boxstarter\BuildPackages\tmp6132.tmp.1.0.0.nupkg'
Boxstarter: Created a temporary package tmp6132.tmp from .\tools\ChocolateyInstall.ps1 in C:\ProgramData\Boxstarter\BuildPackages
+++ Boxstarter starting Calling Chocolatey to install tmp6132.tmp. This may take several minutes to complete...
Chocolatey v2.3.0
Installing the following packages:
tmp6132.tmp
By installing, you accept licenses for the packages.
Downloading package from source 'C:\ProgramData\Boxstarter\BuildPackages'

tmp6132.tmp v1.0.0 (forced)
tmp6132.tmp package files install completed. Performing other installation steps.
 *** LOADING BOXSTARTER ***
Boxstarter: *** HELLO WORLD ***
here
ERROR: The type initializer for '<Module>' threw an exception.
The install of tmp6132.tmp was NOT successful.
Error while running 'C:\ProgramData\chocolatey\lib\tmp6132.tmp\tools\ChocolateyInstall.ps1'.
 See log for details.

Chocolatey installed 0/1 packages. 1 packages failed.
 See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).

Failures
 - tmp6132.tmp (exited -1) - Error while running 'C:\ProgramData\chocolatey\lib\tmp6132.tmp\tools\ChocolateyInstall.ps1'.
 See log for details.
+++ Boxstarter finished Calling Chocolatey to install tmp6132.tmp. This may take several minutes to complete... 00:00:34.4755333
True
Boxstarter: Restore Automatic Updates from Windows Update


Errors       : {}
ComputerName : localhost
Completed    : True
FinishTime   : 10/21/2024 9:02:46 AM
StartTime    : 10/21/2024 9:02:09 AM


Additional Context

It is working correctly in Windows 11 23H2, so something in Windows 11 24H2 is causing Install-BoxstarterPackage to fail for this particular command

@talha5389-teraception talha5389-teraception added the Bug Issues where something has happened which was not expected or intended label Oct 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Issues where something has happened which was not expected or intended
Projects
None yet
Development

No branches or pull requests

1 participant