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

Custom annotation provider for Range attribute not working #1788

Closed
citizenmatt opened this issue Aug 3, 2020 · 0 comments
Closed

Custom annotation provider for Range attribute not working #1788

citizenmatt opened this issue Aug 3, 2020 · 0 comments
Assignees
Milestone

Comments

@citizenmatt
Copy link
Member

The custom annotation provider recognises Unity's [Range] and [Min] attributes and applies the [ValueRange] annotation so that integer data flow analysis knows the range of these serialised fields.

This isn't working - no warnings are shown for e.g. if statements that check a value known to be outside of the range. This appears to be because the [ValueRange] attribute doesn't resolve correctly in a Unity project - the JetBrains.Annotations.ValueRangeAttribute type doesn't exist in Unity's copy of the annotations, while adding an implementation to the project fixes everything.

The implementation resolves against the "External annotations" PSI module, which should contain a copy of JetBrains.Annotations.dll. I thought this was enough to make the annotation resolve correctly, and thought it was working like this during testing. But testing is manual only, because external annotations are not loaded during automated testing. It might also have worked during manual testing because the editor plugin used to include an internalised version of the attributes, but have recently been removed (see #1762).

@citizenmatt citizenmatt added this to the Rider 2020.2.1 milestone Aug 3, 2020
@citizenmatt citizenmatt mentioned this issue Nov 18, 2020
13 tasks
@citizenmatt citizenmatt self-assigned this Nov 20, 2020
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

1 participant