empira / PDFsharp

PDFsharp and MigraDoc Foundation for .NET 6 and .NET Framework
https://docs.pdfsharp.net/
Other
492 stars 114 forks source link

Color.Parse() throws ArgumentException #170

Open Neralem opened 3 weeks ago

Neralem commented 3 weeks ago

Color color = Color.Parse("#2F5C3A"); Does produce an ArgumentException "Requested value '#2F5C3A' was not found." This Exception seems to be handled somewhere but slows down the code a lot. The color is parsed correctly though.

Expected Behavior

Should parse the color without throwing any Exceptions if the format is valid.

Actual Behavior

Always throws an ArgumentException.

Steps to Reproduce the Behavior

Create a new .Net 8 Console Application and try to parse a color from a hex string as I did.

ThomasHoevel commented 3 weeks ago

We'll discuss if this can be improved with MigraDoc 6.2.

Color.FromArgb or Color.FromRgb can be used instead of Color.Parse to avoid the exceptions.