LocalPrintServer instance throw exception in all its methods. Netcore 5 library class

Roman Rodriguez 1 Reputation point
2021-09-04T03:33:25.07+00:00

I am creating an instance of the LocalPrint server
129286-1ff1725b-4709-4cde-a3e1-d9c02d82f087.jpeg

However, all its methods throw an exeption

129315-f1436cb3-04ee-4c3c-8fb5-a65295e3f9d8.png

I had to add the system.printing reference directly from the dll in visual studio 2019

129308-8df6d3b0-deba-4e39-a3a8-acb8b9b912c6.png

I am using netcore 5 , the method is in a class inside a class library project, and the method is invoked from a unit test project.

What do you think the problem is here?

Thanks in advance

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,629 questions
Windows Server Printing
Windows Server Printing
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.Printing: Printer centralized deployment and management, scan and fax resources management, and document services
655 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Limitless Technology 39,501 Reputation points
    2021-09-06T12:34:27.17+00:00

    Hi there,

    I would suggest you to look up the constructors as per the link and see if you have implemted them correctly in your code .

    https://learn.microsoft.com/en-us/dotnet/api/system.printing.localprintserver?view=net-5.0
    https://learn.microsoft.com/en-us/dotnet/api/system.printing.printserver.-ctor?view=net-5.0

    Hope this Answers all your queries , if not please do repost back .
    If an Answer is helpful, please click "Accept Answer" and upvote it : )

    0 comments No comments