Skip to content

Difficult to understand error when switcher.json file has spelling mistakes. #137

Open
@viblo-majority

Description

@viblo-majority

I created a switcher.json file with the following content

{
  "solution": "Minority.Transactions.sln",
  "mapptings": {
      "some nuget name": "path-to-csproj"
   }

This gives a null ref exception:

System.NullReferenceException: Object reference not set to an instance of an object.
   at Dnt.Commands.Packages.SwitchPackagesToProjectsCommand.AddProjectsToSolutionAsync(ReferenceSwitcherConfiguration configuration, IConsoleHost host) in C:\projects\dnt\src\Dnt.Commands\Packages\SwitchPackagesToProjectsCommand.cs:line 42
   at Dnt.Commands.Packages.SwitchPackagesToProjectsCommand.RunAsync(CommandLineProcessor processor, IConsoleHost host) in C:\projects\dnt\src\Dnt.Commands\Packages\SwitchPackagesToProjectsCommand.cs:line 29
   at NConsole.CommandLineProcessor.ProcessSingleAsync(String[] args, Object input)
   at NConsole.CommandLineProcessor.ProcessAsync(String[] args, Object input)
   at NConsole.CommandLineProcessor.Process(String[] args, Object input)
   at Dnt.Program.Main(String[] args) in C:\projects\dnt\src\Dnt\Program.cs:line 33

Of course, this is a stupid spelling mistake to make ('mapptings' should be 'mappings'), but took me a while to find. It would have been great if it had done some kind of validation and told me I had a mistake in the file, since now I dont know if my file is bad or something else (this was the first time I tried dnt).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions