Multiple Cmdlets emits unneeded log/errors

Đang mở
#1,993 0 bình luận 1 reaction 3 người được giao Xem trên GitHub

@SydneyhSmith đang làm issue này rồi.

Từ ngày 21/7/2026.

  • #2014 của @copilot-swe-agent — đang mở

Đánh giá

Issue này chưa được đánh giá.

Mô tả

Prerequisites
  • Write a descriptive title.
  • Make sure you are able to repro it on the latest released version
  • Search the existing issues.
Steps to reproduce
PS /tmp/jjj> $informationPreference = 'Continue'
PS /tmp/jjj> Get-PsResourceRepository

Name      Uri                                      Trusted Priority IsAllowedByPolicy
----      ---                                      ------- -------- -----------------
MAR       https://mcr.microsoft.com/               True    40       True
PSGallery https://www.powershellgallery.com/api/v2 False   50       True

PS /tmp/jjj> Save-PsResource -name az -Path . -TrustRepository -SkipDependencyCheck
Value of isRepositoryUnauthenticated: True
Value of isRepositoryUnauthenticated: True
PS /tmp/jjj> Save-PsResource -name azxx -Path . -TrustRepository -SkipDependencyCheck
Value of isRepositoryUnauthenticated: True
Save-PSResource: Response returned status code package: Not Found.
Save-PSResource: Package(s) 'azxx' could not be installed from registered repositories 'MAR, PSGallery'.
PS /tmp/jjj> Save-PsResource -name FormatMarkdownTable -Path . -TrustRepository -SkipDependencyCheck
Value of isRepositoryUnauthenticated: True
Save-PSResource: Response returned status code package: Not Found.

Information level message on every container registry server API call

https://github.com/PowerShell/PSResourceGet/blob/5b65686149e7c2464e4585e091d0113748e263f7/src/code/ContainerRegistryServerAPICalls.cs#L443

https://github.com/PowerShell/PSResourceGet/blob/5b65686149e7c2464e4585e091d0113748e263f7/test/PublishPSResourceTests/PublishPSResourceContainerRegistryServer.Tests.ps1#L364

  • Information level is being used to pass information to unit test(s)

Container registry server 404 error messages are emitted Cmdlet

in the log MAR API is returning 404 package names "azxxx" and "FormatMarkdownTable" which is normal but the because azxxx does not exist at all and FormatMarkdownTable is available only on powershell gallery. As user I don't need that kind of error messages. IMO error should be handled between Cmdlet and API call logic

Expected behavior
No misleading error messages or test related messages on information level
Actual behavior
-
Error details
Get-Error

Exception             :
    Type       : Microsoft.PowerShell.PSResourceGet.UtilClasses.ResourceNotFoundException
    TargetSite :
        Name          : MoveNext
        DeclaringType : [Microsoft.PowerShell.PSResourceGet.ContainerRegistryServerAPICalls+<SendRequestAsync>d__63]
        MemberType    : Method
        Module        : Microsoft.PowerShell.PSResourceGet.dll
    Message    : Response returned status code package: Not Found.
    Source     : Microsoft.PowerShell.PSResourceGet
    HResult    : -2146233088
    StackTrace :
   at Microsoft.PowerShell.PSResourceGet.ContainerRegistryServerAPICalls.SendRequestAsync(HttpRequestMessage message) in C:\__w\1\s\PSResourceGet\src\code\ContainerRegistryServerAPICalls.cs:line 1167
   at Microsoft.PowerShell.PSResourceGet.ContainerRegistryServerAPICalls.GetHttpResponseJObjectUsingDefaultHeaders(String url, HttpMethod method, Collection`1 defaultHeaders, ErrorRecord& errRecord, Boolean usePagination) in
C:\__w\1\s\PSResourceGet\src\code\ContainerRegistryServerAPICalls.cs:line 969
TargetObject          : Microsoft.PowerShell.PSResourceGet.Cmdlets.SavePSResource
CategoryInfo          : InvalidResult: (Microsoft.PowerShel…lets.SavePSResource:SavePSResource) [Save-PSResource], ResourceNotFoundException
FullyQualifiedErrorId : ResourceNotFound,Microsoft.PowerShell.PSResourceGet.Cmdlets.SavePSResource
InvocationInfo        :
    MyCommand        : Save-PSResource
    ScriptLineNumber : 1
    OffsetInLine     : 1
    HistoryId        : 15
    Line             : Save-PsResource -name FormatMarkdownTable -Path . -TrustRepository -SkipDependencyCheck
    Statement        : Save-PsResource -name FormatMarkdownTable -Path . -TrustRepository -SkipDependencyCheck
    PositionMessage  : At line:1 char:1
                       + Save-PsResource -name FormatMarkdownTable -Path . -TrustRepository -S …
                       + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    InvocationName   : Save-PsResource
    CommandOrigin    : Internal
ScriptStackTrace      : at <ScriptBlock>, <No file>: line 1
PipelineIterationInfo :
      0
      1
Environment data
ModuleType Version    PreRelease Name                                ExportedCommands
---------- -------    ---------- ----                                ----------------
Binary     1.2.0                 Microsoft.PowerShell.PSResourceGet  {Compress-PSResource, Find-PSResource, Get-InstalledPSResource, Get-PSResourceRepository…}

Key   : PSVersion
Value : 7.6.1
Name  : PSVersion


Key   : PSEdition
Value : Core
Name  : PSEdition


Key   : GitCommitId
Value : 7.6.1
Name  : GitCommitId


Key   : OS
Value : macOS 26.3.1
Name  : OS


Key   : Platform
Value : Unix
Name  : Platform


Key   : PSCompatibleVersions
Value : {1.0, 2.0, 3.0, 4.0…}
Name  : PSCompatibleVersions


Key   : PSRemotingProtocolVersion
Value : 2.4
Name  : PSRemotingProtocolVersion


Key   : SerializationVersion
Value : 1.1.0.1
Name  : SerializationVersion


Key   : WSManStackVersion
Value : 3.0
Name  : WSManStackVersion
Visuals

No response

Ngôn ngữ chính
C#
Star
576
Fork
114
Merge trung bình
1 ngày 2 giờ
Pull request đã merge (30 ngày)
7

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của PowerShell/PSResourceGet

Tất cả issue của PowerShell/PSResourceGet

Issue tương tự

Thêm issue về C#

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.