Forum Discussion

rgalli94's avatar
rgalli94
Copper Contributor
Jan 10, 2020

Error configured app-attach

I am working through this guide, and getting a PowerShell error when running this line:

$asTask = ([System.WindowsRuntimeSystemExtensions].GetMethods() | Where {
$_.ToString() -eq 'System.Threading.Tasks.Task`1[TResult]AsTask[TResult,TProgress](Windows.Foundation.IAsyncOperationWithProgress`2[TResult,TProgress])'})[0]

 It's just a generic null array error, but I am not sure why I am getting it or how this Windows class works. Can anyone help?

Cannot index into a null array.
At line:1 char:1
+ $asTask = ([System.WindowsRuntimeSystemExtensions].GetMethods() | Whe ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : NullArray

 

  • turns out I had the wrong build of windows.  Those API'S are specific to the insider build

  • pedinopa's avatar
    pedinopa
    Copper Contributor

    I am getting the same error when I run the stageing script.  I have tried running the entire (stage.ps1) script as well as line by line each time it fails at the same spot

    $asTask = ([System.WindowsRuntimeSystemExtensions].GetMethods() | Where { $_.ToString() -eq 'System.Threading.Tasks.Task`1[TResult] AsTask[TResult,TProgress](Windows.Foundation.IAsyncOperationWithProgress`2[TResult,TProgress])'})[0]

     

    with the message of

    Cannot convert argument "deploymentOptions", with value: "StageInPlace", for "StagePackageAsync" to type
    "Windows.Management.Deployment.DeploymentOptions": "Cannot convert value "StageInPlace" to type "Windows.Management.Deployment.DeploymentOptions".
    Error: "Unable to match the identifier name StageInPlace to a valid enumerator name. Specify one of the following enumerator names and try again:
    None, ForceApplicationShutdown, DevelopmentMode, InstallAllResources, ForceTargetApplicationShutdown, RequiredContentGroupOnly,
    ForceUpdateFromAnyVersion, RetainFilesOnFailure""
    At C:\Users\pedinottip.MVPHP\Desktop\1-stage-AppAttach.ps1:54 char:1
    + $asyncOperation = $packageManager.StagePackageAsync($path, $null, "St ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : NotSpecified: (:) [], MethodException
    + FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

     

    the stage script does create the symbolic link

    rgalli94 

    • pedinopa's avatar
      pedinopa
      Copper Contributor

      turns out I had the wrong build of windows.  Those API'S are specific to the insider build

Resources