SOLVED

Error configured app-attach

Copper Contributor

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

 

5 Replies

@rgalli94 Hi, are you running these as one command? If so you should not be seeing the error below.

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 

@rgalli94 @pedinopa Were you able to resolve this error?
best response confirmed by Karish1 (Microsoft)
Solution

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

@pedinopa Thank you.

1 best response

Accepted Solutions
best response confirmed by Karish1 (Microsoft)
Solution

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

View solution in original post