Skip to content

PlatformHooks.AppName getter blocks indefinitely because of a deadlock #26

@andreiasandei

Description

@andreiasandei

When the AppName getter calls result.Task.Wait(), this blocks the calling thread, which is the UI thread in this case. When the await Package.Current.InstalledLocation.GetFileAsync("AppxManifest.xml") call finishes, it will attempt to run its continuation on the UI thread, but this thread is blocked waiting for the toRun method to finish, which results in a deadlock.

This is better explained here: http://stackoverflow.com/questions/11316438/call-to-await-getfileasync-never-returns-and-app-hangs-in-winrt-app (see Stephen Cleary's answer).

I see that this pattern is implemented in many property getters throughout the SDK and is a potential deadlock source. I think async methods should be used instead of readonly properties in these cases.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions