UWP- Desktop extension using App service connection was failed or throw null exception

muthu pandi 26 Reputation points
2021-06-07T12:27:34.96+00:00

Hi guys,

I have created a packaging application that contains a UWP app(Main app) and a WPF app. In that, I had explored the app service connection between UWP and WPF for passing arguments from those ones.

So I had followed the steps which are mentioned on the below page.

uwp-with-desktop-extension-part-3

I had established a connection, but it returns the status as a failure or sometimes the connection was closed(Null Exception). I didn't know what mistakes I had done. Anyone can help me with this?

TIA

Github URL : WorksManager

Developer technologies | Universal Windows Platform (UWP)
Developer technologies | .NET | Other
{count} vote

Answer accepted by question author
  1. AryaDing-MSFT 2,916 Reputation points
    2021-06-08T09:49:47.987+00:00

    Hi,

    Welcome to Microsoft Q&A!

    If you use uwp api in wpf app, please add Microsoft.Windows.SDK.Contracts NuGet package instead of Windows.Foundation.FoundationContract and Windows.Foundation.UniversalApiContract .

    Besides, you need to add await keyboard for all async methods, such as await args.Request.SendResponseAsync(response). At the same time, please change AppServiceConnectionStatus status = connection.OpenAsync().GetResults() to AppServiceConnectionStatus status = await connection.OpenAsync(). After I modify these as the above, your sample runs well.


    If the response is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.