microsoft/dotnet-apiport

System.InvalidOperationException: Sequence contains more than one matching element

Closed this issue · 5 comments

Microsoft (R) .NET Portability Analyzer 2.5.0.0
Copyright (C) Microsoft Corporation. All rights reserved.
About Tool http://go.microsoft.com/fwlink/?LinkId=506955
View Privacy Statement https://privacy.microsoft.com/en-us/privacystatement

Detecting assembly references [Done]

An unknown error occured.
System.InvalidOperationException: Sequence contains more than one matching element
at System.Linq.Enumerable.SingleOrDefault[TSource](IEnumerable1 source, Func2 predicate)
at Microsoft.Fx.Portability.ApiPortClient.GenerateRequest(IApiPortOptions options, IDependencyInfo dependencyInfo)
at Microsoft.Fx.Portability.ApiPortClient.d__16.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Fx.Portability.ApiPortClient.d__13.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
at ApiPortVS.Analyze.ApiPortVsAnalyzer.d__7.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
at ApiPortVS.Analyze.ProjectAnalyzer.d__10.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at ApiPortVS.AnalyzeMenu.d__7.MoveNext()

Thanks for the report. Is the input you used available for us to debug with? If anything, the commandline args you used are needed for repro.

@NikitaEgorov Can you give a list of all the assembly names you are submitting for analysis?

It seems to be choking on ApiPortClient.cs: L273

foreach (var assembly in dependencyInfo.UserAssemblies)
{
    // Windows's file paths are case-insensitive
    var matchingAssembly = options.InputAssemblies.SingleOrDefault(x => x.Key.Name.Equals(assembly.Location, StringComparison.OrdinalIgnoreCase));

...
}

@twsouthwick Should we comparing more than just the input assembly Name (ie. x.Key.Name)? And compare that the version is the same as well?

We should look at the whole name, but also handle the duplicate case correctly

@twsouthwick What should we do in the duplicate case? Choose the first one?

I use VS2007 Extension.
Extension does not showing list of assemblies