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 @@ -53,12 +53,11 @@ namespace ICSharpCode.ILSpy.Tests
}
[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]

6
ILSpy/App.xaml.cs

@ -92,6 +92,12 @@ namespace ICSharpCode.ILSpy @@ -92,6 +92,12 @@ namespace ICSharpCode.ILSpy
{
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)

2
ILSpy/CommandLineArguments.cs

@ -43,7 +43,7 @@ namespace ICSharpCode.ILSpy @@ -43,7 +43,7 @@ namespace ICSharpCode.ILSpy
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();

4
ILSpy/Properties/launchSettings.json

@ -2,12 +2,12 @@ @@ -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"
}
}
}
Loading…
Cancel
Save