PDFsharp icon indicating copy to clipboard operation
PDFsharp copied to clipboard

Color.Parse() throws ArgumentException

Open Neralem opened this issue 1 year ago • 1 comments

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.

Neralem avatar Sep 09 '24 12:09 Neralem

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.

ThomasHoevel avatar Sep 09 '24 12:09 ThomasHoevel

Fix is coming with version 6.2.0 Preview 3.

ThomasHoevel avatar Jan 23 '25 07:01 ThomasHoevel