Skip to content

System.Drawing.Printing.InvalidPrinterException : No printers are installed. #26882

Closed

Description

@jkotas

System.Drawing.Printing.Tests.PrintDocumentTests/EndPrint_SetValue_ReturnsExpected test failed in dotnet/corefx#31218 on Windows.10.Amd64.ClientRS4.ES.Open-x86-Release

Unhandled Exception of Type System.Drawing.Printing.InvalidPrinterException`

Message :
System.Drawing.Printing.InvalidPrinterException : No printers are installed.
Stack Trace :
   at System.Drawing.Printing.PrinterSettings.GetHdevmodeInternal(String printer) in D:\j\workspace\windows-TGrou---f8ac6754\src\System.Drawing.Common\src\System\Drawing\Printing\PrinterSettings.Windows.cs:line 881
   at System.Drawing.Printing.PrintController.OnStartPrint(PrintDocument document, PrintEventArgs e) in D:\j\workspace\windows-TGrou---f8ac6754\src\System.Drawing.Common\src\System\Drawing\Printing\PrintController.Windows.cs:line 275
   at System.Drawing.Printing.Tests.PrintDocumentTests.TestPrintController.OnStartPrint(PrintDocument document, PrintEventArgs e) in D:\j\workspace\windows-TGrou---f8ac6754\src\System.Drawing.Common\tests\Printing\PrintDocumentTests.cs:line 274
   at System.Drawing.Printing.PrintController.Print(PrintDocument document) in D:\j\workspace\windows-TGrou---f8ac6754\src\System.Drawing.Common\src\System\Drawing\Printing\PrintController.Windows.cs:line 116
   at System.Drawing.Printing.Tests.PrintDocumentTests.EndPrint_SetValue_ReturnsExpected() in D:\j\workspace\windows-TGrou---f8ac6754\src\System.Drawing.Common\tests\Printing\PrintDocumentTests.cs:line 187

Activity

  1. danmoseley commented on Jul 20, 2018

    @danmoseley
    Contributor

    Yes I saw that but the fix is not obvious because this test is already conditionalized on

            public static bool IsAnyInstalledPrinters()
            {
                return PrinterSettings.InstalledPrinters.Count > 0;
            }

    So EnumPrinters says there's a printer but DocumentProperties later fails. This would need debugging, or some tracing added.

  2. ViktorHofer commented on Jul 24, 2018

    @ViktorHofer
    Member

    Maybe someone plugged in a printer between both calls 😂 sorry I couldn't resist.

  3. wfurt commented on Sep 20, 2018

    @wfurt
    Member

    Should we close this one? It is pretty old and I have not seen recent failures.

  4. transferred this issue fromdotnet/corefxon Jan 31, 2020
  5. added this to the 3.0 milestone on Jan 31, 2020
  6. ghost locked as resolved and limited conversation to collaborators on Dec 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions