3

I searched in google but couldn't find the correct answer. Could anyone know how to handle these kind of errors? The error is:

 public override ReadOnlyCollection<SecurityKey> SecurityKeys
    {
        get { throw new NotImplementedException(); }
    }

Warning 20 CA1065 : Microsoft.Design : 'someToken.SecurityKeys.get()' creates an exception of type 'NotImplementedException', an exception type that should not be raised in a property. If this exception instance might be raised, use a different exception type, convert this property into a method, or change this property's logic so that it no longer raises an exception. D:\some\Security\someUserToken.cs

garyh
  • 2,782
  • 1
  • 26
  • 28
Beginner
  • 41
  • 5

1 Answers1

5

If you're throwing it because you haven't written the property, i.e. you're treating it as Not(Yet)ImplementedException, then you need to implement the property.

However, if you're signalling to a consumer that this property is inappropriate, use NotSupportedException instead.

Pete
  • 51
  • 1
  • 2