Skip to content

PrinterSettings.DefaultPageSettings.Color returns wrong value #13367

Closed

Description

@bgobav

.NET version

9.0.0 and higher

Did it work in .NET Framework?

Yes

Did it work in any of the earlier releases of .NET Core or .NET 5+?

Yes, tested on .NET 8.0.6 and .NET 8.0.15

Issue description

When a new instance of PrinterSettings is created and the PrinterName is set, PrinterSettings.DefaultPageSettings.Color returns an incorrect value. The value appears to be negated.

var printersettingsbw = new System.Drawing.Printing.PrinterSettings
{
    PrinterName = "[Name of B/W Printer]"
};

Console.WriteLine(printersettingsbw.DefaultPageSettings.Color); // returns true instead of false

var printersettingscolor = new System.Drawing.Printing.PrinterSettings
{
    PrinterName = "[Name of Color Printer]"
};

Console.WriteLine(printersettingscolor.DefaultPageSettings.Color); // returns false instead of true

Steps to reproduce

  1. Have a locally available color printer printer and b/w printer on your machine. If no printer available you can also use "Microsoft Print to PDF" for step 3.
  2. Create new Instance of PrinterSettings
  3. Set PrinterSettings.PrinterName with the name of you locally available printer. (or "Microsoft Print to PDF")
  4. Get the PrinterSettings.DefaultPageSettings.Color value -> you get a wrong value (for "Microsoft Print to PDF" it should return Color = true but it returns Color = false)
  5. Try the same steps in version below 9.0.0 -> you get the correct value.

Small testproject here:
Testpoject.zip

Activity

  1. added
    untriaged
    on Apr 24, 2025
  2. Tanya-Solyanik commented on Apr 25, 2025

    @Tanya-Solyanik
    Contributor

    @Olina-Zhang @LeafShi1 - could you please find the commit that regressed it and then create a repro branch with the user sample in the ScratchProject.

  3. Olina-Zhang commented on Apr 27, 2025

    @Olina-Zhang
    Member
  4. added
    💥 regression-release
    on Apr 27, 2025
  5. self-assigned this
    on Apr 28, 2025
  6. added a commit that references this issue on Apr 28, 2025
    502b136
  7. removed
    untriaged
    on Apr 28, 2025
  8. added a commit that references this issue on Apr 28, 2025
    7e7c387
  9. added a commit that references this issue on Apr 28, 2025
    6c52f39
  10. Olina-Zhang commented on Apr 30, 2025

    @Olina-Zhang
    Member

    Verified this issue in the latest .NET 10 build: 10.0.100-preview.5.25229.109, it was fixed:

    Image

  11. added this to the 10 Preview5 milestone on Apr 30, 2025
  12. added theissue type on May 5, 2025
  13. Olina-Zhang commented on May 15, 2025

    @Olina-Zhang
    Member

    Verified it in .NET 9.0 SDK build+ binaries built from Release/9.0 branch of Winforms repo, it was fixed as above testing result.

  14. Olina-Zhang commented on May 23, 2025

    @Olina-Zhang
    Member

    Verified this issue in the .NET 9.0.6 test pass build, it was fixed, same result as above.

  15. MelonWang1 commented on May 28, 2025

    @MelonWang1
    Contributor

    Verified this issue in the .NET SDK 10.0.100-preview.5.25272.110 test pass build, it was fixed, same result as above.

  16. locked and limited conversation to collaborators on Jun 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

💥 regression-releasearea-System.Drawing

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions