Hi @Jing Hong Lee,
Are you wondering why it is not recommended to use classes from the System.Printing namespace in Windows Services or ASP.NET applications or services?
Based on the warning message, it's clear that trying to use classes in the System.Printing namespace from a Windows service or ASP.NET application or service may cause unexpected problems, such as service degradation and runtime exceptions.
I didn't find any more information about the official documentation at the moment. But I have seen related explanations:
The System.Printing assembly is dependent upon WPF. WPF is not usable inside a service because a service does not have a UI. It also doesn't make sense in ASP.NET because a UI wouldn't be seen from the client. The documentation doesn't say it won't work, it just says that it may not work as expected and that is because of the WPF underpinning. For example under the hood some of the classes rely on the Dispatcher from WPF. You'll likely only have a single Dispatcher (because that is traditionally the UI thread) so your multi-threaded service/ASP.NET app will be serialized down to a single thread for some calls. This will kill performance and may (depending upon the thread) cause a failure.Therefore, System.Printing show this caution box in the documentation.
Links that may be helpful:
Best regards,
Lan Huang
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
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.