-
Notifications
You must be signed in to change notification settings - Fork 393
UnitConverter.ConvertByAbbreviation method throws AmbitiousUnitParseException when trying to convert "psi" #484
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
Comments
Ah, yes, this is unfortunate. We can't remove Psi or change its abbreviation as that would be a breaking change, I believe Psi is marked as Obsolete and will be removed in a major version bump. I can't immediately think of a good workaround for you, I'm afraid. We do have plans to release a minor breaking change soon to address binary size issues. We can fix this then, but I would not expect it to happen very soon as most of us struggle to find the time needed to push that version release forward. |
See #180 for the list of breaking changes that are wanted in a release, but we will probably address the lowest hanging fruit first just to get something out the door. |
If you want to help out and move the new version along faster, let me know and I'll try to picks some work items from the wishlist and draft up a target changeset for the vNext so we can have a scope that is realistic to complete in a short time. |
@angularsen Should we ignore obsolete units in the parsing implementation? |
@gojanpaolo Good idea, that could actually work with a little bit of reflection code. It would be a breaking change though, unless we only inserted that piece of logic when the ambiguous parsing exception occurs. We could also extend UnitSystem class to be able to remove abbreviations at runtime, since you can already add abbreviations at runtime. |
@angularsen I see. Yes, implementing remove abbreviations at runtime would be a better solution. |
@angularsen I want to help but I'm too busy nowadays. I can join you from November if you still need help. |
@YektaMirkan I think we will be done before November, but for your information here is the roadmap and progress: #487 |
This is fixed in v4 branch. Psi is removed in favor of PoundForcePerSquareInch. |
I use
ConvertByAbbreviation
to convert values. But there is a problem with "psi". It seems like bothPoundForcePerSquareInch
andPsi
have the same abbreviation. So it throws AmbitiousUnitParseException when trying to convert from or to "psi" with this exception message: "Cannot parse 'psi' since it could be either of these: 32, 33 ".Example:
UnitConverter.ConvertByAbbreviation(1, "Pressure", "bar", "psi");
The text was updated successfully, but these errors were encountered: