You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
PrinterSettings.DefaultPageSettings.Color returns wrong value #13367
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.
varprintersettingsbw=newSystem.Drawing.Printing.PrinterSettings{PrinterName="[Name of B/W Printer]"};Console.WriteLine(printersettingsbw.DefaultPageSettings.Color);// returns true instead of falsevarprintersettingscolor=newSystem.Drawing.Printing.PrinterSettings{PrinterName="[Name of Color Printer]"};Console.WriteLine(printersettingscolor.DefaultPageSettings.Color);// returns false instead of true
Steps to reproduce
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.
Create new Instance of PrinterSettings
Set PrinterSettings.PrinterName with the name of you locally available printer. (or "Microsoft Print to PDF")
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)
Try the same steps in version below 9.0.0 -> you get the correct value.
Activity
Tanya-Solyanik commentedon Apr 25, 2025
@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.
Olina-Zhang commentedon Apr 27, 2025
Repro app: https://github.com/Olina-Zhang/winforms/tree/Repro_GH13367/src/test/integration/ScratchProject, regressed by the commit: 0932981
Fix Color value in PageSettings
Fix Color value in PageSettings
Fix Color value in PageSettings (dotnet#13385)
Olina-Zhang commentedon Apr 30, 2025
Verified this issue in the latest .NET 10 build: 10.0.100-preview.5.25229.109, it was fixed:
Olina-Zhang commentedon May 15, 2025
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.
Olina-Zhang commentedon May 23, 2025
Verified this issue in the .NET 9.0.6 test pass build, it was fixed, same result as above.
MelonWang1 commentedon May 28, 2025
Verified this issue in the .NET SDK 10.0.100-preview.5.25272.110 test pass build, it was fixed, same result as above.