Is it necessary to implement LocationContractAttribute.ValidateValueAny?

jahmai's Avatar

jahmai

13 May, 2017 09:18 AM

I have custom LocationContractAttribute classes which all implement ILocationValidationAspect(T).
In 5.0.24-preview, I suddenly need to implement this ValidateValueAny method in dozens of my argument validator attributes.
Is this necessary? Can I just do a dummy implementation of this method?
If it is required, it obsoletes ILocationValidationAspect(T) completely.

  1. Support Staff 1 Posted by PostSharp Techn... on 14 May, 2017 02:58 AM

    PostSharp Technologies's Avatar

    Hello,

    Thank you for the feedback.
    This method was added to support the [DependencyProperty] and [AttachedProperty] features, i.e. you can add a code contract to a [DependencyProperty] or [AttachedProperty] property. If you are not using the new features, it is safe to throw an exception because ValidateValueAny is called only in this case.

    We're going to change the abstract method into a virtual method throwing NotImplementedException to reduce confusion.

    We didn't have time to implement automatic run-time type matching and therefore we require manual implementation. I realize this is not the optimal solution.

    -gael

  2. 2 Posted by jahmai on 14 May, 2017 03:02 AM

    jahmai's Avatar

    Hi Gael,

    Thanks, I will do a dummy implementation in a shared base class to work around the issue until it is made virtual.

    Cheers,

    Jahmai

  3. Support Staff 3 Posted by PostSharp Techn... on 17 May, 2017 03:09 PM

    PostSharp Technologies's Avatar

    Hello,

    We are going to close this request as we believe it was solved. Please feel free to reopen the discussion if you need more help.

    Best regards,

    Jakub

  4. PostSharp Technologies closed this discussion on 17 May, 2017 03:09 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac