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

Microsoft.VSCode.Dsc fails to detect presence of VSCode on my Windows 11 arm virtual machine #105

Open
DonPwrShellHunt opened this issue Nov 4, 2024 · 5 comments

Comments

@DonPwrShellHunt
Copy link

Brief description of your issue

The .NET Tutorial describes using a WinGet configuration file to install .NET 8 SDK, VS Code, and the C# Dev Kit (code extension).
Following the steps in this tutorial on my Windows 11 arm virtual machine fails to install the C# Dev Kit extension and returns output indicating>

> Apply :: VSCodeExtension [install-csharp-dev-kit]
>   The configuration unit failed while attempting to test the current system state.
> VSCode is not installed.

Steps to reproduce

Try to perform a
winget configure dotnet_configuration.winget

using the following config file>

# yaml-language-server: $schema=https://aka.ms/configuration-dsc-schema/0.2
properties:
  resources:
    - resource: Microsoft.WinGet.DSC/WinGetPackage
      id: install-dotnet8-SDK
      directives:
        description: Install .NET 8 SDK
        allowPrerelease: true
      settings:
        id: Microsoft.DotNet.SDK.8
        source: winget
    - resource: Microsoft.WinGet.DSC/WinGetPackage
      id: install-vs-code
      directives:
        description: Install Visual Studio Code
        allowPrerelease: true
      settings:
        id: Microsoft.VisualStudioCode
        source: winget
    - resource: Microsoft.VSCode.DSC/VSCodeExtension
      id: install-csharp-dev-kit
      dependsOn:
        - install-vs-code
      directives:
        description: Install C# Dev Kit
        allowPrerelease: true
      settings:
        name: ms-dotnettools.csdevkit
        exist: true
  configurationVersion: 0.2.0

Expected behavior

I expected the VSCode extension ms-dotnettools.csdevkit to be installed.

Actual behavior

winget configure dotnet_configuration.winget
(where this file was directly downloaded from the .NET Tutorial)

Output includes the following>

Apply :: VSCodeExtension [install-csharp-dev-kit]
  The configuration unit failed while attempting to test the current system state.
**VSCode is not installed**.
<See the log file for additional details>
Some of the configuration units failed while testing their state.

This is due to a mismatch in the value of $vsCodeUserProductCode.

On line 14 of Microsoft.VSCode.Dsc.psm1 this value is defined as>
"{771FD6B0-FA20-440A-A002-3B3BAC16DC50}_is1", but on my system that value is
"{D9E514E7-1A56-452D-9337-2990C0DC4310}_is1".

I'll include a screenshot of the registry showing the uninstall area of HKCU.
Image

Environment

The registry is tested for a key that includes a component of $vsCodeUserProductCode.
"{771FD6B0-FA20-440A-A002-3B3BAC16DC50}_is1" the value used, but on my system that value is
"{D9E514E7-1A56-452D-9337-2990C0DC4310}_is1"

winget --info
Windows Package Manager v1.9.25180
Copyright (c) Microsoft Corporation. All rights reserved.

Windows: Windows.Desktop v10.0.22631.4391
System Architecture: Arm64
Package: Microsoft.DesktopAppInstaller v1.24.25180.0

Winget Directories

Logs %LOCALAPPDATA%\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\Diag…
User Settings %LOCALAPPDATA%\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\sett…
Portable Links Directory (User) %LOCALAPPDATA%\Microsoft\WinGet\Links
Portable Links Directory (Machine) C:\Program Files\WinGet\Links
Portable Package Root (User) %LOCALAPPDATA%\Microsoft\WinGet\Packages
Portable Package Root C:\Program Files\WinGet\Packages
Portable Package Root (x86) C:\Program Files (x86)\WinGet\Packages
Installer Downloads %USERPROFILE%\Downloads

Links

Privacy Statement https://aka.ms/winget-privacy
License Agreement https://aka.ms/winget-license
Third Party Notices https://aka.ms/winget-3rdPartyNotice
Homepage https://aka.ms/winget
Windows Store Terms https://www.microsoft.com/en-us/storedocs/terms-of-sale

Admin Setting State

LocalManifestFiles Disabled
BypassCertificatePinningForMicrosoftStore Disabled
InstallerHashOverride Disabled
LocalArchiveMalwareScanOverride Disabled
ProxyCommandLineOptions Disabled
DefaultProxy Disabled

@Gijsreyn
Copy link
Contributor

Hey @DonPwrShellHunt, I think #125 added additional error handling and version 0.1.3-alpha was released. I was wondering if you can try it again and see if it dumps a proper error message?

@DonPwrShellHunt
Copy link
Author

Testing version 0.1.3 of Microsoft.VSCode.Dsc (manually deleted Microsoft.VSCode.Dsc 0.1.2 module directory 1st)

winget configure test --verbose --logs --accept-configuration-agreements dotnet_configuration.winget

Apply :: WinGetPackage [install-dotnet8-SDK]
  Install .NET 8 SDK
  Module: Microsoft.WinGet.DSC by Microsoft Corporation [Local]
    https://github.com/microsoft/winget-cli
    PowerShell Module with DSC resources related to WinGet configurations
  Settings:
    id: Microsoft.DotNet.SDK.8
    source: winget
Apply :: WinGetPackage [install-vs-code]
  Install Visual Studio Code
  Module: Microsoft.WinGet.DSC by Microsoft Corporation [Local]
    https://github.com/microsoft/winget-cli
    PowerShell Module with DSC resources related to WinGet configurations
  Settings:
    id: Microsoft.VisualStudioCode
    source: winget
Apply :: VSCodeExtension [install-csharp-dev-kit]
  Install C# Dev Kit
  Module: Microsoft.VSCode.Dsc by Microsoft Corporation [PSGallery]
    DSC Resource for Visual Studio Code
  Dependencies: install-vs-code
  Settings:
    name: ms-dotnettools.csdevkit
    exist: true

You are responsible for understanding the configuration settings you are choosing to execute. Microsoft is not responsible for the configuration file you have authored or imported. This configuration may change settings in Windows, install software, change software settings (including security settings), and accept user agreements to third-party packages and services on your behalf.  By running this configuration file, you acknowledge that you understand and agree to these resources and settings. Any applications installed are licensed to you by their owners. Microsoft is not responsible for, nor does it grant any licenses to, third-party packages or services.

Apply :: WinGetPackage [install-dotnet8-SDK]
  System is in the described configuration state.
Apply :: WinGetPackage [install-vs-code]
  System is in the described configuration state.
Apply :: VSCodeExtension [install-csharp-dev-kit]
  The configuration unit failed while attempting to test the current system state.
VSCode is not installed.
<See the log file for additional details>
Some of the configuration units failed while testing their state.

Specific section of log file for this test and output>

2024-11-13 14:56:34.169 [CONF] Invoking `Test` for resource: Microsoft.WinGet.DSC/WinGetPackage...
2024-11-13 14:56:35.873 [CONF] ... done invoking `Test`.
2024-11-13 14:56:36.110 [CONF] [CONF] Testing configuration unit: `install-csharp-dev-kit` [VSCodeExtension]
2024-11-13 14:56:36.110 [CONF] GetUnitProcessorDetails is running in limit mode: False.
2024-11-13 14:56:36.111 [CONF] Creating unit processor for: Microsoft.VSCode.DSC/VSCodeExtension...
2024-11-13 14:56:37.749 [CONF] ... done creating unit processor.
2024-11-13 14:56:37.749 [CONF] Using unit from location: C:\Users\DonPw\AppData\Local\Microsoft\WinGet\Configuration\Modules\Microsoft.VSCode.Dsc\0.1.3\Microsoft.VSCode.Dsc.psd1
2024-11-13 14:56:37.750 [CONF] Invoking `Test` for resource: Microsoft.VSCode.DSC/VSCodeExtension...
2024-11-13 14:56:37.908 [CONF] Microsoft.Management.Configuration.Processor.Exceptions.InvokeDscResourceException: Failed when calling `Test` for resource: VSCodeExtension [Microsoft.VSCode.DSC] Message: 'VSCode is not installed.'

@DonPwrShellHunt
Copy link
Author

Install Insiders edition of code to check uninstall registry key

I installed the insiders edition of vscode using winget configure, with a single resource of Microsoft.WinGet.DSC/WinGetPackage.
The install appeared to work well and my PATH was updated with the directory of code-insiders.cmd.

However, the uninstall registry key from this install does not match what is being tested in Microsoft.VSCode.Dsc.

"{69BD8F7B-65EB-4C6F-A14E-44CFA83712C0}_is1" was created. (regedit to look at HKCU uninstall key)
"{217B4C08-948D-4276-BFBB-BEE930AE5A2C}_is1" is assigned to $vsCodeInsidersUserProductCode for testing app presence.

Image

@DonPwrShellHunt
Copy link
Author

Hey @DonPwrShellHunt, I think #125 added additional error handling and version 0.1.3-alpha was released. I was wondering if you can try it again and see if it dumps a proper error message?

@Gijsreyn - the same error message seems to be returned with 0.1.3-alpha. More details in separate comment.

@Gijsreyn
Copy link
Contributor

Thanks for sharing @DonPwrShellHunt . @ryfu-msft Should we include these paths in the code?

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

3 participants