Skip to content

Commit

Permalink
Set UnrecognizedArgumentHandling to CollectAndContinue
Browse files Browse the repository at this point in the history
  • Loading branch information
christophwille committed May 13, 2024
1 parent 84b78b3 commit 8ad24cd
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 7 deletions.
7 changes: 3 additions & 4 deletions ILSpy.Tests/CommandLineArgumentsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,11 @@ public void VerifyNavigateToOption_NoneTest_Matching_VSAddin()
}

[Test]
public void VerifyCaseSensitivityOfOptionsThrows()
public void VerifyCaseSensitivityOfOptionsDoesntThrow()
{
Action act = () => new CommandLineArguments(new string[] { "--navigateTo:none" });
var cmdLineArgs = new CommandLineArguments(new string[] { "--navigateTo:none" });

act.Should().Throw<McMaster.Extensions.CommandLineUtils.UnrecognizedCommandParsingException>()
.WithMessage("Unrecognized option '--navigateTo:none'");
cmdLineArgs.ArgumentsParser.RemainingArguments.Should().HaveCount(1);
}

[Test]
Expand Down
6 changes: 6 additions & 0 deletions ILSpy/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,12 @@ public App()
{
MessageBox.Show(App.CommandLineArguments.ArgumentsParser.GetHelpText(), "ILSpy Command Line Arguments");
}

if (App.CommandLineArguments.ArgumentsParser.RemainingArguments.Any())
{
string unknownArguments = string.Join(", ", App.CommandLineArguments.ArgumentsParser.RemainingArguments);
MessageBox.Show(unknownArguments, "ILSpy Unknown Command Line Arguments Passed");
}
}

static Assembly ResolvePluginDependencies(AssemblyLoadContext context, AssemblyName assemblyName)
Expand Down
2 changes: 1 addition & 1 deletion ILSpy/CommandLineArguments.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public CommandLineArguments(IEnumerable<string> arguments)
ResponseFileHandling = ResponseFileHandling.ParseArgsAsLineSeparated,

// Note: options are case-sensitive (!), and, default behavior would be UnrecognizedArgumentHandling.Throw on Parse()
// UnrecognizedArgumentHandling = UnrecognizedArgumentHandling.CollectAndContinue
UnrecognizedArgumentHandling = UnrecognizedArgumentHandling.CollectAndContinue
};

app.HelpOption();
Expand Down
4 changes: 2 additions & 2 deletions ILSpy/Properties/launchSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
"profiles": {
"ILSpy": {
"commandName": "Executable",
"executablePath": ".\\ILSpy.exe",
"executablePath": "./ilspy.exe",
"commandLineArgs": "--newinstance"
},
"ILSpy single-instance": {
"commandName": "Executable",
"executablePath": ".\\ILSpy.exe"
"executablePath": "./ilspy.exe"
}
}
}

0 comments on commit 8ad24cd

Please sign in to comment.