Browse Source

Set UnrecognizedArgumentHandling to CollectAndContinue

pull/3205/head
Christoph Wille 1 year ago
parent
commit
8ad24cd470
  1. 7
      ILSpy.Tests/CommandLineArgumentsTests.cs
  2. 6
      ILSpy/App.xaml.cs
  3. 2
      ILSpy/CommandLineArguments.cs
  4. 4
      ILSpy/Properties/launchSettings.json

7
ILSpy.Tests/CommandLineArgumentsTests.cs

@ -53,12 +53,11 @@ namespace ICSharpCode.ILSpy.Tests
} }
[Test] [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>() cmdLineArgs.ArgumentsParser.RemainingArguments.Should().HaveCount(1);
.WithMessage("Unrecognized option '--navigateTo:none'");
} }
[Test] [Test]

6
ILSpy/App.xaml.cs

@ -92,6 +92,12 @@ namespace ICSharpCode.ILSpy
{ {
MessageBox.Show(App.CommandLineArguments.ArgumentsParser.GetHelpText(), "ILSpy Command Line Arguments"); 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) static Assembly ResolvePluginDependencies(AssemblyLoadContext context, AssemblyName assemblyName)

2
ILSpy/CommandLineArguments.cs

@ -43,7 +43,7 @@ namespace ICSharpCode.ILSpy
ResponseFileHandling = ResponseFileHandling.ParseArgsAsLineSeparated, ResponseFileHandling = ResponseFileHandling.ParseArgsAsLineSeparated,
// Note: options are case-sensitive (!), and, default behavior would be UnrecognizedArgumentHandling.Throw on Parse() // Note: options are case-sensitive (!), and, default behavior would be UnrecognizedArgumentHandling.Throw on Parse()
// UnrecognizedArgumentHandling = UnrecognizedArgumentHandling.CollectAndContinue UnrecognizedArgumentHandling = UnrecognizedArgumentHandling.CollectAndContinue
}; };
app.HelpOption(); app.HelpOption();

4
ILSpy/Properties/launchSettings.json

@ -2,12 +2,12 @@
"profiles": { "profiles": {
"ILSpy": { "ILSpy": {
"commandName": "Executable", "commandName": "Executable",
"executablePath": ".\\ILSpy.exe", "executablePath": "./ilspy.exe",
"commandLineArgs": "--newinstance" "commandLineArgs": "--newinstance"
}, },
"ILSpy single-instance": { "ILSpy single-instance": {
"commandName": "Executable", "commandName": "Executable",
"executablePath": ".\\ILSpy.exe" "executablePath": "./ilspy.exe"
} }
} }
} }
Loading…
Cancel
Save