`apicompat` crashes for incorrect flag
- Dominant language
- C#
- Stars
- 3.2k
- Forks
- 1.3k
- PR merge metrics
- PR metrics pending
Description
### Describe the bug
When provided with an incorrect option, `apicompat` crashes.
### To Reproduce
Run `apicompat` with an incorrect option. e.g.,
```
apicompat -l "foo.dll" -r "bar.dll" --respectInternals=false
```
Note the use of `--respectInternals` instead of `--respect-internals`
### Exceptions (if any)
```
Unhandled exception: System.IO.FileNotFoundException: Could not find the provided path '--respectInternals=false' to load binaries from.
at Microsoft.DotNet.ApiSymbolExtensions.AssemblySymbolLoader.LoadFromPaths(IEnumerable`1 paths, ImmutableHashSet`1 referenceAssemblyNamesToIgnore) in /_/src/Compatibility/Microsoft.DotNet.ApiSymbolExtensions/AssemblySymbolLoader.cs:line 290
at Microsoft.DotNet.ApiSymbolExtensions.AssemblySymbolLoader.LoadAssemblies(String[] paths) in /_/src/Compatibility/Microsoft.DotNet.ApiSymbolExtensions/AssemblySymbolLoader.cs:line 97
at Microsoft.DotNet.ApiCompatibility.Runner.ApiCompatRunner.CreateAssemblySymbols(IReadOnlyList`1 metadataInformation, Boolean& resolvedExternallyProvidedAssemblyReferences) in /_/src/Compatibility/ApiCompat/Microsoft.DotNet.ApiCompatibility/Runner/ApiCompatRunner.cs:line 123
at Microsoft.DotNet.ApiCompatibility.Runner.ApiCompatRunner.ExecuteWorkItems() in /_/src/Compatibility/ApiCompat/Microsoft.DotNet.ApiCompatibility/Runner/ApiCompatRunner.cs:line 41
at Microsoft.DotNet.ApiCompat.ValidateAssemblies.Run(Func`2 logFactory, Boolean generateSuppressionFile, Boolean preserveUnnecessarySuppressions, Boolean permitUnnecessarySuppressions, String[] suppressionFiles, String suppressionOutputFile, String noWarn, Boolean respectInternals, Boolean enableRuleAttributesMustMatch, String[] excludeAttributesFiles, Boolean enableRuleCannotChangeParameterName, String[] leftAssemblies, String[] rightAssemblies, Boolean enableStrictMode, String[][] leftAssembliesReferences, String[][] rightAssembliesReferences, Boolean createWorkItemPerAssembly, ValueTuple`2[] leftAssembliesTransformationPatterns, ValueTuple`2[] rightAssembliesTransformationPatterns) in /_/src/Compatibility/ApiCompat/Microsoft.DotNet.ApiCompat.Shared/ValidateAssemblies.cs:line 87
at Microsoft.DotNet.ApiCompat.Tool.Program.<>c__DisplayClass0_0.b__0(ParseResult parseResult) in /_/src/Compatibility/ApiCompat/Microsoft.DotNet.ApiCompat.Tool/Program.cs:line 200
at System.CommandLine.CliCommand.<>c__DisplayClass30_0.b__0(ParseResult context)
at System.CommandLine.Invocation.AnonymousSynchronousCliAction.Invoke(ParseResult parseResult)
at System.CommandLine.Invocation.InvocationPipeline.Invoke(ParseResult parseResult)
```
### Further technical details
details of dotnet --info
.NET SDK:
Version: 9.0.304
Commit: f12f5f689e
Workload version: 9.0.300-manifests.ad61bb1c
MSBuild version: 17.14.16+5d8159c5f
Runtime Environment:
OS Name: Windows
OS Version: 10.0.22631
OS Platform: Windows
RID: win-x64
Base Path: C:\Program Files\dotnet\sdk\9.0.304\
.NET workloads installed:
[maccatalyst]
Installation Source: VS 17.14.36408.4
Manifest Version: 18.5.9214/9.0.100
Manifest Path: C:\Program Files\dotnet\sdk-manifests\9.0.100\microsoft.net.sdk.maccatalyst\18.5.9214\WorkloadManifest.json
Install Type: Msi
[maui-windows]
Installation Source: VS 17.14.36408.4
Manifest Version: 9.0.51/9.0.100
Manifest Path: C:\Program Files\dotnet\sdk-manifests\9.0.100\microsoft.net.sdk.maui\9.0.51\WorkloadManifest.json
Install Type: Msi
[android]
Installation Source: VS 17.14.36408.4
Manifest Version: 35.0.78/9.0.100
Manifest Path: C:\Program Files\dotnet\sdk-manifests\9.0.100\microsoft.net.sdk.android\35.0.78\WorkloadManifest.json
Install Type: Msi
[ios]
Installation Source: VS 17.14.36408.4
Manifest Version: 18.5.9214/9.0.100
Manifest Path: C:\Program Files\dotnet\sdk-manifests\9.0.100\microsoft.net.sdk.ios\18.5.9214\WorkloadManifest.json
Install Type: Msi
[aspire]
Installation Source: VS 17.14.36408.4
Manifest Version: 8.2.2/8.0.100
Manifest Path: C:\Program Files\dotnet\sdk-manifests\8.0.100\microsoft.net.sdk.aspire\8.2.2\WorkloadManifest.json
Install Type: Msi
Configured to use loose manifests when installing new manifests.
Host:
Version: 9.0.8
Architecture: x64
Commit: aae90fa090
.NET SDKs installed:
8.0.100 [C:\Program Files\dotnet\sdk]
9.0.304 [C:\Program Files\dotnet\sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 6.0.36 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.19 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 9.0.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.36 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.19 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 9.0.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 6.0.36 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 8.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 8.0.19 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 9.0.8 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Other architectures found:
x86 [C:\Program Files (x86)\dotnet]
registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]
Environment variables:
Not set
global.json file:
\global.json
Learn more:
https://aka.ms/dotnet/info
Download .NET:
https://aka.ms/dotnet/download
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.