marticliment / UniGetUI

UniGetUI: The Graphical Interface for your package managers. Could be terribly described as a package manager manager to manage your package managers
https://www.marticliment.com/unigetui/
MIT License
10.62k stars 348 forks source link

[BUG] 3.1.0 Beta 1 - PowerShell - Cannot convert null to type "System.DateTime". #2383

Closed RonnyTNL closed 2 weeks ago

RonnyTNL commented 2 weeks ago

Please confirm these before moving forward

UniGetUI Version

3.1.0 Beta 1

Windows version, edition and architecture

Win10 x64

Describe your issue

PowerShell log shows "Cannot convert null to type "System.DateTime". Same happens when I run the command in a regular powershell.

Steps to reproduce the issue

Run 3.1.0 Beta 1 and check the package manager log

UniGetUI Log

N/A

Package Managers Logs

Logged subprocess-based task on manager PowerShell. Task type is ListUpdates
Subprocess executable: "C:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe"
Command-line arguments: ""
Process start time: 02/07/2024 10:54:08
Process end time:   02/07/2024 10:54:17

-- Process STDIN
 ...

-- Process STDOUT
 ...

-- Process STDERR
  Cannot convert null to type "System.DateTime".
  At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:7016 char:17
  +                 $InstalledDate = $null
  +                 ~~~~~~~~~~~~~~~~~~~~~~
      + CategoryInfo          : MetadataError: (:) [], ArgumentTransformationMetadataException
      + FullyQualifiedErrorId : RuntimeException

Return code: SUCCESS (0)

——————————————————————————————————————————

Logged subprocess-based task on manager PowerShell. Task type is ListPackages
Subprocess executable: "C:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe"
Command-line arguments: " -NoProfile -Command Get-InstalledModule"
Process start time: 02/07/2024 10:54:08
Process end time:   02/07/2024 10:54:15

-- Process STDOUT
 ...

-- Process STDERR
  Cannot convert null to type "System.DateTime".
  At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:7016 char:17
  +                 $InstalledDate = $null
  +                 ~~~~~~~~~~~~~~~~~~~~~~
      + CategoryInfo          : MetadataError: (:) [], ArgumentTransformationMetadataException
      + FullyQualifiedErrorId : RuntimeException

Relevant information

This output does not contain the ZWNBSP (Unicode BOM).

Screenshots and videos

No response

marticliment commented 2 weeks ago

Please attach the verbose logs so I can see the exact ran command

RonnyTNL commented 2 weeks ago
Logged subprocess-based task on manager PowerShell. Task type is ListUpdates
Subprocess executable: "C:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe"
Command-line arguments: ""
Process start time: 02/07/2024 11:48:54
Process end time:   02/07/2024 11:49:04

-- Process STDIN
  function Test-GalleryModuleUpdate {
      param (
          [Parameter(Mandatory,ValueFromPipelineByPropertyName)] [string] $Name,
          [Parameter(Mandatory,ValueFromPipelineByPropertyName)] [version] $Version,
          [Parameter(Mandatory,ValueFromPipelineByPropertyName)] [string] $Repository,
          [switch] $NeedUpdateOnly
      )
      process {
          $URLs = @{}
          @(Get-PSRepository).ForEach({$URLs[$_.Name] = $_.SourceLocation})
          $page = Invoke-WebRequest -Uri ($URLs[$Repository] + "/package/$Name") -UseBasicParsing -Maximum 0 -ea Ignore
          [version]$latest = Split-Path -Path ($page.Headers.Location -replace "$Name." -replace ".nupkg") -Leaf
          $needsupdate = $Latest -gt $Version
          if ($needsupdate) {
                  Write-Output($Name + "|" + $Version.ToString() + "|" + $Latest.ToString() + "|" + $Repository)
          }
      }
  }
  Get-InstalledModule | Test-GalleryModuleUpdate

  exit

-- Process STDOUT
  Windows PowerShell
  Copyright (C) Microsoft Corporation. All rights reserved.
  Try the new cross-platform PowerShell https://aka.ms/pscore6
  PS C:\Program Files\WingetUI> function Test-GalleryModuleUpdate {
  >>     param (
  >>         [Parameter(Mandatory,ValueFromPipelineByPropertyName)] [string] $Name,
  >>         [Parameter(Mandatory,ValueFromPipelineByPropertyName)] [version] $Version,
  >>         [Parameter(Mandatory,ValueFromPipelineByPropertyName)] [string] $Repository,
  >>         [switch] $NeedUpdateOnly
  >>     )
  >>     process {
  >>         $URLs = @{}
  >>         @(Get-PSRepository).ForEach({$URLs[$_.Name] = $_.SourceLocation})
  >>         $page = Invoke-WebRequest -Uri ($URLs[$Repository] + "/package/$Name") -UseBasicParsing -Maximum 0 -ea Ignore
  >>         [version]$latest = Split-Path -Path ($page.Headers.Location -replace "$Name." -replace ".nupkg") -Leaf
  >>         $needsupdate = $Latest -gt $Version
  >>         if ($needsupdate) {
  >>                 Write-Output($Name + "|" + $Version.ToString() + "|" + $Latest.ToString() + "|" + $Repository)
  >>         }
  >>     }
  >> }
  >> Get-InstalledModule | Test-GalleryModuleUpdate
  >> 
  PS C:\Program Files\WingetUI> 
  PS C:\Program Files\WingetUI> exit

-- Process STDERR
  Cannot convert null to type "System.DateTime".
  At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:7016 char:17
  +                 $InstalledDate = $null
  +                 ~~~~~~~~~~~~~~~~~~~~~~
      + CategoryInfo          : MetadataError: (:) [], ArgumentTransformationMetadataException
      + FullyQualifiedErrorId : RuntimeException

Return code: SUCCESS (0)

——————————————————————————————————————————

Logged subprocess-based task on manager PowerShell. Task type is ListPackages
Subprocess executable: "C:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe"
Command-line arguments: " -NoProfile -Command Get-InstalledModule"
Process start time: 02/07/2024 11:48:54
Process end time:   02/07/2024 11:49:02

-- Process STDOUT
  Version    Name                                Repository           Description                                        
  -------    ----                                ----------           -----------                                        
  1.8.1791   Microsoft.WinGet.Client             PSGallery            PowerShell Module for the Windows Package Manage...
  1.0.18     SpeculationControl                  PSGallery            This module provides the ability to query the sp...

-- Process STDERR
  Cannot convert null to type "System.DateTime".
  At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:7016 char:17
  +                 $InstalledDate = $null
  +                 ~~~~~~~~~~~~~~~~~~~~~~
      + CategoryInfo          : MetadataError: (:) [], ArgumentTransformationMetadataException
      + FullyQualifiedErrorId : RuntimeException

Return code: SUCCESS (0)
marticliment commented 2 weeks ago

I am afraid this is a bug with PowerShell, since UniGetUI directly calls the built-in powershell Get-InstalledModule command