Error "Sequence contains no matching element" occurred while checking updates for packages
- Dominant language
- C#
- Stars
- 3.2k
- Forks
- 1.3k
- PR merge metrics
- PR metrics pending
Description
### Describe the bug
There is a C# project for example
```xml
Exe
net10.0
enable
enable
```
[TestPackage.Net10.Sdk111.zip](https://github.com/user-attachments/files/31718781/TestPackage.Net10.Sdk111.zip)
[TestPackage.Net10.Sdk400.zip](https://github.com/user-attachments/files/31718782/TestPackage.Net10.Sdk400.zip)
Command `dotnet package list --include-transitive --outdated` will not work on NET SDK `10.0.2xx` `10.0.3xx` `10.0.4xx`, even `11.0.100 preview`, but does work on `10.0.1xx` and before
### Steps to reproduce
Using `global.json` to switch .NET SDK version
```json
{
"sdk": {
"version": "10.0.400" # or 10.0.111
}
}
```
and run command
```
dotnet package list --include-transitive --outdated -v diag
```
### Expected behavior
SDK `10.0.111`
```
还原完成(0.3)
在 0.7 秒内生成 已成功
使用了以下源:
https://api.nuget.org/v3/index.json
C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\
项目“TestPackage.Net10.Sdk111”具有以下针对其包的更新
[net10.0]:
可传递的包 已解决 最新
> Microsoft.Windows.SDK.Win32Docs 0.1.42-alpha 在源中未找到
> Microsoft.Windows.SDK.Win32Metadata 71.0.14-preview 在源中未找到
> Microsoft.Windows.WDK.Win32Metadata 0.13.25-experimental 在源中未找到
```
### Actual behavior
SDK `10.0.400`
```
还原完成(0.3)
在 0.7 秒内生成 已成功
CACHE https://api.nuget.org/v3/registration5-gz-semver2/microsoft.windows.cswin32/index.json
CACHE https://api.nuget.org/v3/registration5-gz-semver2/microsoft.windows.sdk.win32docs/index.json
CACHE https://api.nuget.org/v3/registration5-gz-semver2/microsoft.windows.sdk.win32metadata/index.json
CACHE https://api.nuget.org/v3/registration5-gz-semver2/microsoft.windows.wdk.win32metadata/index.json
error: Sequence contains no matching element
trace: System.InvalidOperationException: Sequence contains no matching element
trace: at System.Linq.ThrowHelper.ThrowNoMatchException()
trace: at System.Linq.Enumerable.First[TSource](IEnumerable`1 source, Func`2 predicate)
trace: at NuGet.CommandLine.XPlat.ListPackageCommandRunner.UpdatePackagesWithSourceMetadata(List`1 frameworks, Dictionary`2 packageMetadata, ListPackageArgs listPackageArgs)
trace: at NuGet.CommandLine.XPlat.ListPackageCommandRunner.GetProjectMetadataAsync(String projectPath, ListPackageReportModel listPackageReportModel, ListPackageArgs listPackageArgs)
trace: at NuGet.CommandLine.XPlat.ListPackageCommandRunner.GetReportDataAsync(ListPackageArgs listPackageArgs)
trace: at NuGet.CommandLine.XPlat.ListPackageCommandRunner.ExecuteCommandAsync(ListPackageArgs listPackageArgs)
trace: at NuGet.CommandLine.XPlat.ListPackageCommand.<>c__DisplayClass0_0.<b__0>d.MoveNext()
trace: --- End of stack trace from previous location ---
trace: at System.CommandLine.Invocation.InvocationPipeline.InvokeAsync(ParseResult parseResult, CancellationToken cancellationToken)
trace: at System.CommandLine.ParseResult.Invoke(InvocationConfiguration configuration)
trace: at NuGet.CommandLine.XPlat.Program.MainInternal(String[] args, CommandOutputLogger log, IEnvironmentVariableReader environmentVariableReader, IVirtualProjectBuilder virtualProjectBuilder)
```
### Is this a regression?
Yes
### Are there any workarounds?
_No response_
### dotnet --info output
```console
.NET SDK:
Version: 11.0.100-preview.7.26381.103
Commit: e2c1e00b3d
Workload version: 11.0.100-manifests.b33825ff
MSBuild version: 18.10.0-1.26381.103+e2c1e00b3
Runtime Environment:
OS Name: Windows
OS Version: 10.0.26200
OS Platform: Windows
RID: win-x64
Base Path: C:\Program Files\dotnet\sdk\11.0.100-preview.7.26381.103
.NET workloads installed:
[android]
安装源文件: SDK 11.0.100-preview.7, VS 18.9.12120.119
清单版本: 37.0.0-preview.7.2131/11.0.100-preview.7
清单路径: C:\Program Files\dotnet\sdk-manifests\11.0.100-preview.7\microsoft.net.sdk.android\37.0.0-preview.7.2131\WorkloadManifest.json
安装类型: Msi
[ios]
安装源文件: SDK 11.0.100-preview.7, VS 18.9.12120.119
清单版本: 26.5.11997-net11-p7/11.0.100-preview.7
清单路径: C:\Program Files\dotnet\sdk-manifests\11.0.100-preview.7\microsoft.net.sdk.ios\26.5.11997-net11-p7\WorkloadManifest.json
安装类型: Msi
[maccatalyst]
安装源文件: SDK 11.0.100-preview.7, VS 18.9.12120.119
清单版本: 26.5.11997-net11-p7/11.0.100-preview.7
清单路径: C:\Program Files\dotnet\sdk-manifests\11.0.100-preview.7\microsoft.net.sdk.maccatalyst\26.5.11997-net11-p7\WorkloadManifest.json
安装类型: Msi
[macos]
安装源文件: SDK 11.0.100-preview.7
清单版本: 26.5.11997-net11-p7/11.0.100-preview.7
清单路径: C:\Program Files\dotnet\sdk-manifests\11.0.100-preview.7\microsoft.net.sdk.macos\26.5.11997-net11-p7\WorkloadManifest.json
安装类型: Msi
[maui-windows]
安装源文件: SDK 11.0.100-preview.7, VS 18.9.12120.119
清单版本: 11.0.0-preview.7.26406.9/11.0.100-preview.7
清单路径: C:\Program Files\dotnet\sdk-manifests\11.0.100-preview.7\microsoft.net.sdk.maui\11.0.0-preview.7.26406.9\WorkloadManifest.json
安装类型: Msi
已配置为在安装新清单时使用松散清单。
Host:
Version: 11.0.0-preview.7.26381.103
Architecture: x64
Commit: e2c1e00b3d
.NET SDKs installed:
10.0.111 [C:\Program Files\dotnet\sdk]
10.0.400 [C:\Program Files\dotnet\sdk]
11.0.100-preview.7.26381.103 [C:\Program Files\dotnet\sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 8.0.30 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 9.0.19 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 10.0.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 11.0.0-preview.7.26381.103 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 8.0.30 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 9.0.19 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 10.0.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 11.0.0-preview.7.26381.103 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 8.0.30 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 9.0.19 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 10.0.11 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 11.0.0-preview.7.26381.103 [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:
Not found
Learn more:
https://aka.ms/dotnet/info
Download .NET:
https://aka.ms/dotnet/download
```
### IDE version
_No response_
### Other details
_No response_
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the failing `dotnet package list --include-transitive --outdated` command and the stack-trace entry point `ListPackageCommandRunner.UpdatePackagesWithSourceMetadata`. Reproduce using the attached projects across the listed .NET SDK versions and compare the package metadata handling. Done means the command completes without `Sequence contains no matching element` and produces the expected outdated-package report.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 58/100