dotnet / dotnet/api-docs-sync

Unit tests fail when running against net6.0

未关闭
#69 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
port-to-tripleslash
主要语言
C#
星标
14
派生
21
PR 合并指标
30 天内没有已合并 PR

描述

Running unit tests against the `main` branch with the projects targeting `net6.0` is leading to a failed test.

```
Libraries.Tests.PortToTripleSlashTests.Port_Basic
Source: PortToTripleSlashTests.cs line 15
Duration: 1 sec

Message:
System.Exception : Diagnostic errors found.
Stack Trace:
ToTripleSlashPorter.CheckDiagnostics(MSBuildWorkspace workspace, String stepName) line 479
ToTripleSlashPorter.GetOrAddProject(MSBuildWorkspace workspace, Dictionary`2 projects, String projectPath) line 420
ToTripleSlashPorter.GetProjectInfo(String projectPath, Boolean isMono) line 369
ToTripleSlashPorter.Port() line 142
ToTripleSlashPorter.Start(Configuration config) line 127
PortToTripleSlashTests.PortToTripleSlash(String testDataDir, Boolean save, Boolean skipInterfaceImplementations, String assemblyName, String namespaceName, String typeName) line 54
PortToTripleSlashTests.Port_Basic() line 17
```

The diagnostic error is:

```
"Failure - Msbuild failed when processing the file 'C:\\Users\\jeffhand\\AppData\\Local\\Temp\\0shltoqo.fn2\\Project\\MyAssembly.csproj' with message:
The expression \"[MSBuild]::GetTargetFrameworkIdentifier(net5.0)\" cannot be evaluated. MSB0001: Internal MSBuild Error: A required NuGet assembly was not found.
Expected Path: C:\\Program Files\\dotnet\\sdk\\6.0.100-preview.2.21158.2 C:\\Program Files\\dotnet\\sdk\\6.0.100-preview.2.21158.2\\Sdks\\Microsoft.NET.Sdk\\targets\\Microsoft.NET.TargetFrameworkInference.targets"
```

贡献指南

这个仓库没有索引到贡献指南

调研方向

从第 15 行的 PortToTripleSlashTests.cs 开始,针对 net6.0 重现 Port_Basic。通过第 479 行的 ToTripleSlashPorter.CheckDiagnostics 和 MSBuild 工作区调用跟踪报告的失败,然后验证测试不再报告缺少的 NuGet 程序集或 MSBuild 诊断信息。

由索引模型根据 Issue 内容生成。

评估

技术栈
csharp
领域
build-system, testing
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。