dotnet / dotnet/wpf

WPF + .Net 5 + WinRT APIs not yet functional

Open
#4,097 18 comments 2 reactions 1 assignee Claimed by @ryalanms View on GitHub
Investigate
Dominant language
C#
Stars
7.7k
Forks
1.3k
Avg merge
1d 11h
Merged PRs (30d)
61

Description

**Problem description:**

Critical WinRT APIs when consumed from a WPF .Net 5 app are not yet functional. One example

```
Progress progressCallback = new Progress((op) =>
{
//var appxProgress = new AppxProgress(op.percentage, "...");
//progress.Report(appxProgress);
});

var pkgManager = new PackageManager();

// MP! fixme: why do we hang on the await on occasion?
Debug.WriteLine("Installing package ...");
DeploymentResult result = await pkgManager.AddPackageAsync(uriToAppx, urisToDependencies, DeploymentOptions.ForceTargetApplicationShutdown).AsTask(progressCallback).WaitOrCancel(stop);
Debug.WriteLine("Package installed ...");
```

After commenting out the UI update portion of the code, AddPackageAsync still hangs. If I remove the use of DeploymentProgress, AddPackageAsync always completes.

**Actual behavior:**

Call hangs.

**Expected behavior:**

Call should complete.

**Minimal repro:**

Shown above. You can remove the WaitOrCancel() bit for your testing. It's there only to support cancellation, which happens to work even when the call is hung.

The repo that contains a "working" solution is located here: https://github.com/Noemata/AppxInstaller

The call hangs about 50% of the time. So it works 50% of the time when re-run the app. :-(

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.