question

xFoondom-3258 avatar image
0 Votes"
xFoondom-3258 asked NicoZhu-MSFT commented

C# - UWP AppInfo throws NotImplementedException

I'm developing a C# WinForms app, using the UWP API. I'm attempting to read notifications programatically, and I have succeeded so far. However, whenever I call AppInfo from the UserNotification class, I get a NotImplementedException, no matter what property I read from AppInfo.

Does anyone have any suggestions?

I have only been able to find 1 answer to this question and it's not very useful, and also a few years old. This is a major roadblock in my project, any help is massively appreciated!

Thank you in advance.

dotnet-csharpwindows-uwpwindows-forms
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Do you use desktop bridge to package current app?

0 Votes 0 ·

1 Answer

NicoZhu-MSFT avatar image
0 Votes"
NicoZhu-MSFT answered NicoZhu-MSFT commented

Hello, Welcome to Micorosoft Q&A,

UWP AppInfo throws NotImplementedException

Derive the exception, it looks notification.AppInfo.DisplayInfo has not implemented for WinForm platform. For this scenario, we have a workaround for getting AppInfo with AppDiagnosticInfo api. Please refer the following code

 var list = await AppDiagnosticInfo.RequestInfoAsync();
 var currentPackage = list.Where(o => o.AppInfo.PackageFamilyName == Package.Current.Id.FamilyName).FirstOrDefault();
 if (currentPackage != null)
 {
     AppInfo currentAppInfo = currentPackage.AppInfo;
     var display = currentAppInfo.DisplayInfo;
 }

Update

UserNotificationListener has no DualApiPartitionAttribute, it means it is not support for desktop app, I'm afraid you could not use desktop app to get all other app's notifications.



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.


· 4
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Wouldn't this get the display name of my program? That's not what I'm trying to do, I'm sorry if I didn't explain thoroughly enough.
I need the name of the program that sends any notification. This would include Google Chrome, The Snipping Tool, Windows Defender.

I'm using a Notification Listener in order to catch any and all notifications, and it works perfectly except for the AppInfo property of the UserNotification.

0 Votes 0 ·

UserNotificationListener has no DualApiPartitionAttribute, it means it is not support for desktop app, I'm afraid you could not use desktop app to get all other app's notifications.

0 Votes 0 ·

It just boggles my mind, because I'm very much able to receive the notifications and their text, just not the AppInfo.

0 Votes 0 ·
Show more comments