Since patch KB5008212 was installed, printing has stopped working in the UWP app I'm developing. Also the official microsoft samples to print doesn't work either (https://github.com/microsoft/windows-universal-samples/tree/main/Samples/Printing). Uninstalling the patch got it working again until Windows automatically reinstalled it.
I use appPOS58PORTABLE+ printer (https://www.approxtpv.es/es/impresoras-58mm/124-apppos58portable.html) connected by Bluetooth, but it also fails with other portable printers of the same type.
I will describe how the error occurs and the solutions that I have tried and have not worked:
When I try to print something from the UWP app, I get this error notification:
When opening the print queue, you can see that there is a document that is pending to print with an error status:
At the time this error occurs, a "Warning" is logged in the "Event Viewer", in the "Administrative Events" view:
Event content:
Log Name: System
Source: Microsoft-Windows-DistributedCOM
Date: 5/24/2022 1:31:47 PM
Event ID: 10016
Task Category: None
Level: Warning
Keywords: Classic
User: DESKTOP-5LRC872\User
Computer: DESKTOP-5LRC872
Description:
The machine-default permission settings do not grant Local Activation permission for the COM Server application with CLSID
{C2F03A33-21F5-47FA-B4BB-156362A2F239}
and APPID
{316CDED5-E4AE-4B15-9113-7055D84DCC97}
to the user DESKTOP-5LRC872\User SID (S-1-5-21-2115282427-3345914188-1249518056-1002) from address LocalHost (Using LRPC) running in the application container Microsoft.Windows.ShellExperienceHost_10.0.19041.1320_neutral_neutral_cw5n1h2txyewy SID (S-1-15-2-155514346-2573954481-755741238-1654018636-1233331829-3075935687-2861478708). This security permission can be modified using the Component Services administrative tool.
Due to this error that is recorded in the "Event Viewer", I have followed the steps of a forum where a similar case occurred (https://answers.microsoft.com/es-es/windows/forum/all/la-configuraci%C3%B3n-de-permisos-espec%C3%ADfico/d2d7d947-ad76-4069-af19-47d61be8b4ad). After following these steps, it still doesn't work. However the message changes slightly. Now instead of saying "The machine-default permission settings do not grant Local Activation permission for the COM Server application with CLSID..." it says: "The application-specific permission settings do not grant Local Activation permission for the COM Server application with CLSID...".
I am attaching screenshots of how the permissions configuration has been after following these steps:
As you can see, the user "User" that describes the error does have "Local Activation" permission.
Other things I've tried and don't work: https://answers.microsoft.com/es-es/windows/forum/all/no-conecta-impresora-compartida-version-windows/6e36987f-0d1f-4475-b93e-a6de8a906623
I have also tried different settings in the printer properties, like these:
but it doesn't help either
Important: if in the print queue (where the error occurs) we right click and restart on the document that has failed, the problem is "solved" and the document prints correctly. However, doing this causes errors to be logged in "Event Viewer":
In the attached image you can see that after the printing error (the DistributedCOM Warning) that I mentioned before, if you right click and restart, two new errors of source "PrintService" are registered. The first one reports that " No printers were found." and the second that "The system cannot find the file specified." even though the document prints correctly in this case.
Events content:
Log Name: Microsoft-Windows-PrintService/Admin
Source: Microsoft-Windows-PrintService
Date: 5/24/2022 1:34:38 PM
Event ID: 372
Task Category: Printing a document
Level: Error
Keywords: Classic Spooler Event,Document Print Job
User: DESKTOP-5LRC872\User
Computer: DESKTOP-5LRC872
Description:
The document Print Document, owned by User, failed to print on printer appPOS58PORTABLE+. Try to print the document again, or restart the print spooler.
Data type: XPS2GDI. Size of the spool file in bytes: 635092. Number of bytes printed: 0. Total number of pages in the document: 10. Number of pages printed: 0. Client computer: \DESKTOP-5LRC872. Win32 error code returned by the print processor: 3012. No printers were found.
Log Name: Microsoft-Windows-PrintService/Admin
Source: Microsoft-Windows-PrintService
Date: 5/24/2022 1:34:40 PM
Event ID: 372
Task Category: Printing a document
Level: Error
Keywords: Classic Spooler Event,Document Print Job
User: DESKTOP-5LRC872\User
Computer: DESKTOP-5LRC872
Description:
The document Print Document, owned by User, failed to print on printer appPOS58PORTABLE+. Try to print the document again, or restart the print spooler.
Data type: XPS2GDI. Size of the spool file in bytes: 635092. Number of bytes printed: 351623. Total number of pages in the document: 10. Number of pages printed: 0. Client computer: \DESKTOP-5LRC872. Win32 error code returned by the print processor: 2. The system cannot find the file specified.
However, although this way works, it is not a viable solution for me, I need it to work without errors the first time, and not have to restart every time a document is printed from the UWP application.