Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MagicFormat enum values change in 13.7.0 #1627

Closed
flytzen opened this issue May 9, 2024 · 3 comments
Closed

MagicFormat enum values change in 13.7.0 #1627

flytzen opened this issue May 9, 2024 · 3 comments
Milestone

Comments

@flytzen
Copy link

flytzen commented May 9, 2024

Magick.NET version

13.7.0

Environment (Operating system, version and so on)

Any

Description

The enum Magick.Format had a new value added in 13.7.0.
This can cause problems with nested dependencies and lead to an exception being thrown.

Specifically:

Steps to Reproduce

ZXing is a library with bindings to a lot of image processors, including Magick. The ZXing.Magick binding specifically references Magick.Net.Core 12.3.0.
It has a line which specifically references MagickFormat.Gray. In v13.6.0 and before, that was 83. However, in 13.7.0, 83 is Gradient.

Consumers of ZXing have to make an explicit reference to Magick.Net as Magick.Net.Core is not enough on its own. That, then, leads to Dependabot wanting to upgrade that reference to the latest, which then breaks ZXing. Once a consumer of ZXing upgrades Magick.Net to 13.7.0, they will start getting exceptions about Gradient not being supported. This is because ZXing continues to pass in 83 to Magick.Net - but the meaning of that has changed.

The GoogleAuthenticator library I work on has run in to this: BrandonPotter/GoogleAuthenticator#213

ZXing can of course be upgraded but that may cause other issues.

You may or may not feel this is an issue in Magick.Net - I can see both arguments. I can see one way of resolving it in Magick.Net, which would be to explicitly assign integers to the Magick.Format enum - but that does risk breaking consumers of 13.7 :(

@dlemstra
Copy link
Owner

dlemstra commented May 9, 2024

I don't know if version 12.3.0 of Magick.Net.Core is fully compatible with the latest version of ImageMagick. I have been added formats in alphabetical order for years but never realized this would be a breaking change. I can fix the changes I made for the version 13.X range to allow backwards compatibility. But I will make a note that I will reorder them again for the 14.X release. So when this release becomes available you will probably need to update the Core library. I had a release ready for today but I will include this patch to reorder the enums to allow backwards compatibility and publish a new release tonight.

@dlemstra dlemstra added this to the 13.8.0 milestone May 9, 2024
@flytzen
Copy link
Author

flytzen commented May 10, 2024

Transient dependencies are a pain :) Thank you so much.
You can assign explicit values in the enum, ie. Gray = 83 so that you can both order them how you like and keep backwards compatibility.

@dlemstra
Copy link
Owner

I don't want to assign them values that might make someone assume that the values have meaning.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants