Skip to content

Issue with logic when comparing args with command names. #48281

@MarceloGal

Description

@MarceloGal

Type of issue

Code doesn't work

Description

During the loop of comparison of command vs args in debug mode (using '/d' as first argument):

foreach (string commandName in args)
{
    Console.WriteLine($"-- {commandName} --");  
    // Execute the command with the name passed as an argument.
    ICommand command = commands.FirstOrDefault(c => c.Name == commandName);
    if (command == null)
    {
        Console.WriteLine("No such command is known.");
        return;
    }  
    command.Execute();  
    Console.WriteLine();
}

It always reach the return instruction (making the program jump the verification of other commands) becasue '/d' is not a function uploaded by any dll if we follow the tutorial.

Page URL

https://learn.microsoft.com/en-us/dotnet/core/tutorials/creating-app-with-plugin-support

Content source URL

https://github.com/dotnet/docs/blob/main/docs/core/tutorials/creating-app-with-plugin-support.md

Document Version Independent Id

f25a6e1a-cb10-867b-0522-a377bf9d016b

Platform Id

27dfa56b-f293-9bef-c78b-c1d5ab8f5969

Article author

@jkoritzinsky

Metadata

  • ID: 06023407-704f-0ace-e89a-eedd9f95a007
  • PlatformId: 27dfa56b-f293-9bef-c78b-c1d5ab8f5969
  • Service: dotnet-fundamentals

Related Issues

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions