Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nullability in overridden Execute method in extended Command class. #1355

Closed
stormwulfren opened this issue Nov 5, 2023 · 1 comment
Closed
Labels
bug Something isn't working needs triage

Comments

@stormwulfren
Copy link

stormwulfren commented Nov 5, 2023

Information

  • OS: ArchLinux
  • Terminal: Konsole
  • IDE: JetBrains Rider 2023.2.2

Describe the bug
Behaviour as described in this PR is occurring in my instance.
#1255

To Reproduce

using Spectre.Console.Cli;
internal sealed class Cli : Command<Cli.Settings>
{
    internal sealed class Settings : CommandSettings
    {
    }
       
    public override int Execute(CommandContext context, Settings settings)
    {
        return 0;
    }
}

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

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

Error remains regardless if params have the [NotNull] annotation or not.

Edit:
Interestingly, I'm using version 0.47.0 (pulled this morning), but the referenced file CommandOfT.cs doesn't look like the one in main branch. The version I have does indeed have [NotNull] attributes on the Execute and Validate methods. Not sure what's going on here ...

@stormwulfren stormwulfren added bug Something isn't working needs triage labels Nov 5, 2023
@github-project-automation github-project-automation bot moved this to Todo 🕑 in Spectre Console Nov 5, 2023
@stormwulfren
Copy link
Author

Apologies. User error, I'm using stable. I see it's fixed in prerelease.

@github-project-automation github-project-automation bot moved this from Todo 🕑 to Done 🚀 in Spectre Console Nov 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs triage
Projects
Status: Done 🚀
Development

No branches or pull requests

1 participant