Error attempting to apply NotEmptyAttribute to ICollection<T> parameter

bobp's Avatar


15 Nov, 2016 04:35 PM

When attempting to apply [NotEmpty] to an ICollection<T> I get the following error:

Service.Add(System.Collections.Generic.ICollection<NameValue>)@value is of type System.Collections.Generic.ICollection`1<T><NameValue> which can not be matched to any ValidateValue method of aspect PostSharp.Patterns.Contracts.NotEmptyAttribute.

If I change the parameter to ICollection, it works, but that requires changing the interface and is not as useful.

  1. Support Staff 1 Posted by PostSharp Techn... on 18 Nov, 2016 10:06 AM

    PostSharp Technologies's Avatar


    this is an enhancement we plan to implement in PostSharp 4.3. It is filed internally as a ticket #14219. We will let you know here as we release a version including this enhancement. However, we can't provide a time estimation yet.

    Best regards,

  2. Support Staff 2 Posted by PostSharp Techn... on 09 Jan, 2017 03:48 PM

    PostSharp Technologies's Avatar


    We're closing the ticket for now as the bug has been internally filed as issue #14219. We will contact you as soon as the bug fix has been released.

    For more details on our support policies and prioritization of bug fixes, please visit

    PostSharp Team

  3. PostSharp Technologies closed this discussion on 09 Jan, 2017 03:48 PM.

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

Keyboard shortcuts


? 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