All commands returned `CommandNotFoundException` until `Get-Command -Module Microsoft.WinGet.Client` had been invoked.

Abierto
#1,826 2 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
35/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
powershell
Área
cli

Línea de trabajo

Empieza reproduciendo el problema con Get-WinGetPackage, Get-Command -Module Microsoft.WinGet.Client y Get-Module Microsoft.PowerShell.PSResourceGet en las versiones de PowerShell y Windows indicadas. Rastrea por qué los comandos no están disponibles antes de la detección o invocación del módulo; se considera completado cuando los comandos funcionan sin ejecutar primero Get-Command o Get-Module.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Needs-Attention :wave:
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

I was unable to invoke any of the commands listed by Get-Command -Module Microsoft.WinGet.Client ^1 until I invoked that command. As an example, Get-WinGetPackage returned the undermentioned Error XML.

Expected behavior

$? should have returned $True after before invoking Get-Module Microsoft.PowerShell.PSResourceGet.

Actual behavior

It returned $False until I'd invoked Get-Module Microsoft.PowerShell.PSResourceGet.

Error details
<Objs Version="1.1.0.1" xmlns="http://schemas.microsoft.com/powershell/2004/04">
  <Obj RefId="0">
    <TN RefId="0">
      <T>System.Management.Automation.ErrorRecord#PSExtendedError</T>
      <T>System.Object</T>
    </TN>
    <ToString>The term 'Get-WinGetPackage' is not recognized as a name of a cmdlet, function, script file, or executable program._x000D__x000A_Check the spelling of the name, or if a path was included, verify that the path is correct and try again.</ToString>
    <MS>
      <Obj N="Exception" RefId="1">
        <TN RefId="1">
          <T>System.Management.Automation.CommandNotFoundException</T>
          <T>System.Management.Automation.RuntimeException</T>
          <T>System.SystemException</T>
          <T>System.Exception</T>
          <T>System.Object</T>
        </TN>
        <ToString>System.Management.Automation.CommandNotFoundException: The term 'Get-WinGetPackage' is not recognized as a name of a cmdlet, function, script file, or executable program._x000D__x000A_Check the spelling of the name, or if a path was included, verify that the path is correct and try again._x000D__x000A_   at System.Management.Automation.CommandDiscovery.LookupCommandInfo(String commandName, CommandTypes commandTypes, SearchResolutionOptions searchResolutionOptions, CommandOrigin commandOrigin, ExecutionContext context)_x000D__x000A_   at System.Management.Automation.PipelineOps.AddCommand(PipelineProcessor pipe, CommandParameterInternal[] commandElements, CommandBaseAst commandBaseAst, CommandRedirection[] redirections, ExecutionContext context)_x000D__x000A_   at System.Management.Automation.PipelineOps.InvokePipeline(Object input, Boolean ignoreInput, CommandParameterInternal[][] pipeElements, CommandBaseAst[] pipeElementAsts, CommandRedirection[][] commandRedirections, FunctionContext funcContext)_x000D__x000A_   at System.Management.Automation.Interpreter.ActionCallInstruction`6.Run(InterpretedFrame frame)_x000D__x000A_   at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)</ToString>
        <Props>
          <S N="ErrorRecord">The term 'Get-WinGetPackage' is not recognized as a name of a cmdlet, function, script file, or executable program._x000D__x000A_Check the spelling of the name, or if a path was included, verify that the path is correct and try again.</S>
          <S N="CommandName">Get-WinGetPackage</S>
          <B N="WasThrownFromThrowStatement">false</B>
          <S N="TargetSite">System.Management.Automation.CommandInfo LookupCommandInfo(System.String, System.Management.Automation.CommandTypes, System.Management.Automation.SearchResolutionOptions, System.Management.Automation.CommandOrigin, System.Management.Automation.ExecutionContext)</S>
          <S N="Message">The term 'Get-WinGetPackage' is not recognized as a name of a cmdlet, function, script file, or executable program._x000D__x000A_Check the spelling of the name, or if a path was included, verify that the path is correct and try again.</S>
          <Obj N="Data" RefId="2">
            <TN RefId="2">
              <T>System.Collections.ListDictionaryInternal</T>
              <T>System.Object</T>
            </TN>
            <DCT>
              <En>
                <S N="Key">System.Management.Automation.Interpreter.InterpretedFrameInfo</S>
                <Obj N="Value" RefId="3">
                  <TN RefId="3">
                    <T>System.Management.Automation.Interpreter.InterpretedFrameInfo[]</T>
                    <T>System.Array</T>
                    <T>System.Object</T>
                  </TN>
                  <LST>
                    <S>&lt;ScriptBlock&gt;</S>
                  </LST>
                </Obj>
              </En>
            </DCT>
          </Obj>
          <Nil N="InnerException" />
          <Nil N="HelpLink" />
          <S N="Source">System.Management.Automation</S>
          <I32 N="HResult">-2146233087</I32>
          <S N="StackTrace">   at System.Management.Automation.CommandDiscovery.LookupCommandInfo(String commandName, CommandTypes commandTypes, SearchResolutionOptions searchResolutionOptions, CommandOrigin commandOrigin, ExecutionContext context)_x000D__x000A_   at System.Management.Automation.PipelineOps.AddCommand(PipelineProcessor pipe, CommandParameterInternal[] commandElements, CommandBaseAst commandBaseAst, CommandRedirection[] redirections, ExecutionContext context)_x000D__x000A_   at System.Management.Automation.PipelineOps.InvokePipeline(Object input, Boolean ignoreInput, CommandParameterInternal[][] pipeElements, CommandBaseAst[] pipeElementAsts, CommandRedirection[][] commandRedirections, FunctionContext funcContext)_x000D__x000A_   at System.Management.Automation.Interpreter.ActionCallInstruction`6.Run(InterpretedFrame frame)_x000D__x000A_   at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)</S>
        </Props>
      </Obj>
      <S N="TargetObject">Get-WinGetPackage</S>
      <S N="FullyQualifiedErrorId">CommandNotFoundException</S>
      <Obj N="InvocationInfo" RefId="4">
        <TN RefId="4">
          <T>System.Management.Automation.InvocationInfo</T>
          <T>System.Object</T>
        </TN>
        <ToString>System.Management.Automation.InvocationInfo</ToString>
        <Props>
          <Nil N="MyCommand" />
          <Obj N="BoundParameters" RefId="5">
            <TN RefId="5">
              <T>System.Collections.Generic.Dictionary`2[[System.String, System.Private.CoreLib, Version=10.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.Object, System.Private.CoreLib, Version=10.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]</T>
              <T>System.Object</T>
            </TN>
            <DCT />
          </Obj>
          <Obj N="UnboundArguments" RefId="6">
            <TN RefId="6">
              <T>System.Collections.Generic.List`1[[System.Object, System.Private.CoreLib, Version=10.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]</T>
              <T>System.Object</T>
            </TN>
            <LST />
          </Obj>
          <I32 N="ScriptLineNumber">1</I32>
          <I32 N="OffsetInLine">1</I32>
          <I64 N="HistoryId">11</I64>
          <S N="ScriptName"></S>
          <S N="Line">Get-WinGetPackage</S>
          <S N="Statement">Get-WinGetPackage</S>
          <S N="PositionMessage">At line:1 char:1_x000D__x000A_+ Get-WinGetPackage_x000D__x000A_+ ~~~~~~~~~~~~~~~~~</S>
          <S N="PSScriptRoot"></S>
          <Nil N="PSCommandPath" />
          <S N="InvocationName">Get-WinGetPackage</S>
          <I32 N="PipelineLength">0</I32>
          <I32 N="PipelinePosition">0</I32>
          <B N="ExpectingInput">false</B>
          <Obj N="CommandOrigin" RefId="7">
            <TN RefId="7">
              <T>System.Management.Automation.CommandOrigin</T>
              <T>System.Enum</T>
              <T>System.ValueType</T>
              <T>System.Object</T>
            </TN>
            <ToString>Internal</ToString>
            <I32>1</I32>
          </Obj>
          <Nil N="DisplayScriptPosition" />
        </Props>
      </Obj>
      <I32 N="ErrorCategory_Category">13</I32>
      <S N="ErrorCategory_Activity"></S>
      <S N="ErrorCategory_Reason">CommandNotFoundException</S>
      <S N="ErrorCategory_TargetName">Get-WinGetPackage</S>
      <S N="ErrorCategory_TargetType">String</S>
      <S N="ErrorCategory_Message">ObjectNotFound: (Get-WinGetPackage:String) [], CommandNotFoundException</S>
      <B N="SerializeExtendedInfo">false</B>
      <S N="ErrorDetails_ScriptStackTrace">at &lt;ScriptBlock&gt;, &lt;No file&gt;: line 1</S>
    </MS>
  </Obj>
</Objs>
Environment data

Get-Module Microsoft.PowerShell.PSResourceGet returns $Null, but $PSVersionTable returns:

PSVersion                 : 7.6.0-preview.4
PSEdition                 : Core
GitCommitId               : 7.6.0-preview.4
OS                        : Microsoft Windows 10.0.26120
Platform                  : Win32NT
PSCompatibleVersions      : {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion : 2.3
SerializationVersion      : 1.1.0.1
WSManStackVersion         : 3.0
Visuals

No response

Lenguaje dominante
C#
Estrellas
576
Forks
114
Merge medio
23 h 17 min
PR fusionados (30 d)
8

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de PowerShell/PSResourceGet

Todos los issues de PowerShell/PSResourceGet

Issues similares

Más issues de C#

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.