Skip to content

Conversation

@0xced
Copy link
Contributor

@0xced 0xced commented Jul 12, 2023

When subclassing Command<TSettings> which has the [NotNull] attributes, Rider/ReSharper gives this warning:

Nullability of type of parameter 'context' in method does not match overridden member int Spectre.Console.Cli.Command<TSettings>.Execute(CommandContext, TSettings) (possibly because of nullability attributes)

image

When subclassing Command<TSettings> which does not have the [NotNull] attributes, Rider/ReSharper gives this warning:

The nullability attribute has no effect and can be safely removed

image

The solution is simply to remove the [NotNull] attributes.

Since <Nullable>enable</Nullable> is set in the project, they are actually not necessary. By the way, the non-generic Command class does not have the [NotNull] attributes.

When subclassing `Command<TSettings>` which has the [NotNull] attributes, Rider/ReSharper gives this warning:
> Nullability of type of parameter 'context' in method does not match overridden member `int Spectre.Console.Cli.Command<TSettings>.Execute(CommandContext, TSettings)` (possibly because of nullability attributes)

When subclassing `Command<TSettings>` which does not have the [NotNull] attributes, Rider/ReSharper gives this warning:
> The nullability attribute has no effect and can be safely removed

The solution is simply to remove the [NotNull] attributes.

Since `<Nullable>enable</Nullable>` is set in the project, they are actually not necessary. By the way, the non-generic `Command` class does not have the [NotNull] attributes.
@patriksvensson patriksvensson merged commit 2af901a into spectreconsole:main Jul 12, 2023
@patriksvensson
Copy link
Contributor

Thanks @0xced! Merged! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants