Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ProximityDevice NFC events not triggered / NFC doesn't work at all #9358

Closed
baaaaif opened this issue Feb 22, 2024 · 4 comments
Closed

ProximityDevice NFC events not triggered / NFC doesn't work at all #9358

baaaaif opened this issue Feb 22, 2024 · 4 comments
Labels
area-External Not owned by the WinUI team, not actionable in this repository. question

Comments

@baaaaif
Copy link

baaaaif commented Feb 22, 2024

Describe the bug

We have an app that we migrated from UWP to WinUI 3 a while ago.
Unfortunately, we discovered that with the WinUI 3 app the ProximityDevice NFC feature no longer triggers events / no longer works at all.

We use simple code that can be found in many examples and have set
<DeviceCapability Name="proximity"/>

var proximityDevice = Windows.Networking.Proximity.ProximityDevice.GetDefault();
var messageSubscriptionId = proximityDevice.SubscribeForMessage("NDEF", (device, message) =>
{
    Console.WriteLine(message.Data.ToArray());
});

this works in UWP and doesn't work in WinUI3
See min Repo examples
Works: https://github.com/minze-it/BlankProximityUWP
Doesn't work: https://github.com/minze-it/BlankProximityMaui

Steps to reproduce the bug

  • Start min repo apps
  • Click Button
  • Try read a NDEF 213/215/216 Tag which contains a NDEF message

Expected behavior

SubscribeForMessage delegate handler is invoked

Screenshots

No response

NuGet package version

WinUI 3 - Windows App SDK 1.4.5: 1.4.240411001

Windows version

Windows 11 (22H2): Build 22621, Windows 11 (21H2): Build 22000

Additional context

Also tested with 1.5 p1. No difference

@baaaaif baaaaif added the bug Something isn't working label Feb 22, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot added the needs-triage Issue needs to be triaged by the area owners label Feb 22, 2024
@DarranRowe
Copy link

Because anything under the Windows namespace is a Windows feature, then I would think that it would be faster to obtain support elsewhere. This would be a Windows issue after all.
The fact that you are attempting to access ProximityDevice in a WinUI 3 application should be inconsequential. While I can't personally test it right now, you should have the exact same problem in any desktop application. WinUI 3 is just a library that runs in the desktop environment.

@baaaaif
Copy link
Author

baaaaif commented Feb 23, 2024

Because anything under the Windows namespace is a Windows feature, then I would think that it would be faster to obtain support elsewhere. This would be a Windows issue after all. The fact that you are attempting to access ProximityDevice in a WinUI 3 application should be inconsequential. While I can't personally test it right now, you should have the exact same problem in any desktop application. WinUI 3 is just a library that runs in the desktop environment.

Hi @DarranRowe, thank you for your quick reply.

It's the Windows namespace, but as I understand it, exclusively as part of the Windows Runtime.
https://learn.microsoft.com/en-us/uwp/api/windows.networking.proximity.proximitydevice?view=winrt-22621

I assumed that when it comes to UWP and WinUI apps then this would be the correct place to go.
Am I mistaken here? What would be the correct repository for WinRT Apis to report problems?
https://github.com/microsoft/WindowsAppSDK/ will probably result in the same thing as the issue here, right?

At least it can't be https://github.com/dotnet/runtime

@bpulliam bpulliam added question area-External Not owned by the WinUI team, not actionable in this repository. and removed bug Something isn't working needs-triage Issue needs to be triaged by the area owners labels Feb 23, 2024
@DarranRowe
Copy link

For questions, the Microsoft Q&A site is the better option here. The C# and Universal Windows Platform (UWP) tags would help round things down.
For reporting bugs, you would have to use the Feedback Hub app that comes as part of Windows.

Regarding whether this is the correct place to report it. You have to remember that WinUI 3 is just a library that is loaded into a desktop application. This repository only covers anything under the Microsoft.UI.Xaml namespace (and related namespaces like Microsoft.UI.Composition and Microsoft.UI.Content). Windows.Networking.Proximity.ProximityDevice falls outside of this scope, even if it is being used in a WinUI 3 application.
While I am unable to personally test it, I believe that you would end up with the same issue if you just removed WinUI 3. So using ProximityDevice in a WinForms, WPF or even a Windows API application would give you the same issue as you are seeing now. There are still a few WinRT runtime classes that are not documented as being unusable from desktop applications that do not work correctly.

@codendone
Copy link
Contributor

Let's track this via microsoft/WindowsAppSDK#4356.

@codendone codendone closed this as not planned Won't fix, can't repro, duplicate, stale Apr 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-External Not owned by the WinUI team, not actionable in this repository. question
Projects
None yet
Development

No branches or pull requests

4 participants