Feature request: "Custom (attribute)" option for null checking
Exactly what it says in the title. I use PostSharp in many of my projects, and would like to have the option to automatically annotate parameters and return values with its [NotNull]/[Required] attributes using ReSharper null checking, as those are what I always use for parameter/return value null checking. Making it a custom option would let this work for users of other AOP tools, too.
Any chance?
Thanks,
Alistair
Please sign in to leave a comment.
Hello Alistair!
Thank you for contacting us.
Corresponding request is reported here - https://youtrack.jetbrains.com/issue/RSRP-463008
You are welcome to comment or vote for it.
Thank you.
Ah, that doesn't seem to be a request for the same thing? (It seems to be talking about extending ReSharper's own nullability analysis, rather than adding another null checking pattern.)
Hello Alistair!
Please accept my appologies, mixed up issue links, here's the correct one - https://youtrack.jetbrains.com/issue/RSRP-454461
Thank you.
Hello, please check this sample: https://github.com/postsharp/PostSharp.Samples/tree/master/Framework/PostSharp.Samples.ResharperAnnotations
If I understand your question correctly, it should do what you are asking for.
It takes advantage of the fact that ReSharper works with any attribute named NotNull and CanBeNull as documented at https://www.jetbrains.com/help/resharper/Code_Analysis__Annotations_in_Source_Code.html.
Best regards,
-tony