Skip to content

Commit 2210b29

Browse files
committed
Removed unnecessary [NotNull] attributes
In a previous commit, I introduced the `[ValidatedNotNull]` attribute to assure Code Analysis that the base methods in `TopicRepositoryBase` were performing parameter validation and, thus, could be assured that those parameters would not be `null`. That was a necessary and useful addition. When I did that, however, I also added `[NotNull]`. There are cases where this makes sense. But it doesn't make sense here, since the value of the parameters is already marked as not nullable. In fact, this causes newer versions of Roslyn's static flow analysis to identify this as a mismatch between these versions of the methods and the methods that `override` them in e.g. `SqlTopicRepository`. This seems like a false positive to me, and I could even see that being a nuissance in other scenarios, but as it's the attribute isn't even needed here, we'll evaluate that issue if and when we come across a scenario where it really is a problem.
1 parent d175f22 commit 2210b29

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

OnTopic/Repositories/TopicRepositoryBase.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ protected virtual ContentTypeDescriptorCollection SetContentTypeDescriptors(Cont
234234
| METHOD: ROLLBACK
235235
\-------------------------------------------------------------------------------------------------------------------------*/
236236
/// <inheritdoc />
237-
public virtual void Rollback([ValidatedNotNull, NotNull]Topic topic, DateTime version) {
237+
public virtual void Rollback([ValidatedNotNull]Topic topic, DateTime version) {
238238

239239
/*------------------------------------------------------------------------------------------------------------------------
240240
| Validate parameters
@@ -300,7 +300,7 @@ public virtual void Rollback([ValidatedNotNull, NotNull]Topic topic, DateTime ve
300300
| METHOD: SAVE
301301
\-------------------------------------------------------------------------------------------------------------------------*/
302302
/// <inheritdoc />
303-
public virtual int Save([ValidatedNotNull, NotNull]Topic topic, bool isRecursive = false, bool isDraft = false) {
303+
public virtual int Save([ValidatedNotNull]Topic topic, bool isRecursive = false, bool isDraft = false) {
304304

305305
/*------------------------------------------------------------------------------------------------------------------------
306306
| Validate parameters
@@ -387,7 +387,7 @@ topic is ContentTypeDescriptor descriptor &&
387387
| METHOD: MOVE
388388
\-------------------------------------------------------------------------------------------------------------------------*/
389389
/// <inheritdoc />
390-
public virtual void Move([ValidatedNotNull, NotNull]Topic topic, [ValidatedNotNull, NotNull]Topic target) {
390+
public virtual void Move([ValidatedNotNull]Topic topic, [ValidatedNotNull]Topic target) {
391391

392392
/*------------------------------------------------------------------------------------------------------------------------
393393
| Validate parameters
@@ -409,7 +409,7 @@ public virtual void Move([ValidatedNotNull, NotNull]Topic topic, [ValidatedNotNu
409409
/// <param name="target">A topic object under which to move the source topic.</param>
410410
/// <param name="sibling">A topic object representing a sibling adjacent to which the topic should be moved.</param>
411411
/// <returns>Boolean value representing whether the operation completed successfully.</returns>
412-
public virtual void Move([ValidatedNotNull, NotNull]Topic topic, [ValidatedNotNull, NotNull]Topic target, Topic? sibling) {
412+
public virtual void Move([ValidatedNotNull]Topic topic, [ValidatedNotNull]Topic target, Topic? sibling) {
413413

414414
/*------------------------------------------------------------------------------------------------------------------------
415415
| Validate parameters
@@ -455,7 +455,7 @@ public virtual void Move([ValidatedNotNull, NotNull]Topic topic, [ValidatedNotNu
455455
| METHOD: DELETE
456456
\-------------------------------------------------------------------------------------------------------------------------*/
457457
/// <inheritdoc />
458-
public virtual void Delete([ValidatedNotNull, NotNull]Topic topic, bool isRecursive) {
458+
public virtual void Delete([ValidatedNotNull]Topic topic, bool isRecursive) {
459459

460460
/*------------------------------------------------------------------------------------------------------------------------
461461
| Validate parameters

0 commit comments

Comments
 (0)