-
Notifications
You must be signed in to change notification settings - Fork 391
Description
Describe the bug
Using XF/UWP, we are successfully using the Windows.Devices.PointOfService.PosPrinting API to connect to network receipt printers.
The PosPrinter.FromIdAsync() call will popup a dialog for the user to confirm they wish to pair with the printer. From there we claim the printer, enable, and send it a print job.
Using MAUI/WinUI3, the same code with the same 'pointOfService' capability set in the manifest returns null almost instantly. No dialog is shown. I know the printer is available because I retrieved the ID using:
DeviceInformation.FindAllAsync(PosPrinter.GetDeviceSelector(PosConnectionTypes.IP));
...and I can of course run the UWP version side by side and successfully get the PosPrinter handle using the same ID once I have confirmed using the pairing dialog.
The same happens on a vanilla WinUI3 app without using MAUI.
Steps to reproduce the bug
- Ensure a POS printer (such as Epson TM-M30) is connected to the network.
- Create a blank WinUI3 desktop app.
- Add PointOfService capability to the manifest.
- Add this method to MainWindow.xaml.cs and call PosPrinting() in the myButton_Click listener.
async void PosPrinting()
{
DeviceInformationCollection deviceCollection = await DeviceInformation.FindAllAsync(PosPrinter.GetDeviceSelector(PosConnectionTypes.IP));
if (deviceCollection.Count > 0)
{
DeviceInformation deviceInfo = deviceCollection[0];
PosPrinter p = await PosPrinter.FromIdAsync(deviceInfo.Id);
if (p != null)
{
Debug.WriteLine(p.DeviceId);
}
}
}
p will be null.
Expected behavior
Successfully retrieve a PosPrinter object using PosPrinter.FromIdAsync(deviceInfo.Id). If first attempt to connect to the PosPrinter, first show a dialog for the user to confirm pairing.
Screenshots
NuGet package version
No response
Windows app type
- UWP
- Win32
Device form factor
Desktop
Windows version
Windows 11 (21H2): Build 22000
Additional context
Microsoft.WindowsAppSDK versions is
1.1.3
1.2.2.220902.1.-preview1