什么不作業
在某些時候,曾經出現在測驗資源管理器中的測驗串列現在不再出現。當我嘗試重繪 串列時,我收到系統在某處遇到空值的錯誤。
我有以下設定:
VSCODE
Version: 1.70.2 (user setup)
Commit: e4503b30fc78200f846c62cf8091b76ff5547662
Date: 2022-08-16T05:35:13.448Z
Electron: 18.3.5
Chromium: 100.0.4896.160
Node.js: 16.13.2
V8: 10.0.139.17-electron.0
OS: Windows_NT x64 10.0.19044
小部件解決方案設定:
我有一個主專案和一個這樣組織的測驗專案:
Widgets.Server 專案檔案:
在某種程度上,這是專案檔案包含的內容 - 注意:平臺
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net5.0-windows</TargetFramework>
<PlatformTarget>AnyCPU</PlatformTarget>
<IsPackable>true</IsPackable>
這是測驗專案檔案包含的內容 - 匹配平臺:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net5.0-windows</TargetFramework>
<PlatformTarget>AnyCPU</PlatformTarget>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.1.0" />
<PackageReference Include="TagLibSharp" Version="2.2.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="3.1.2">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Moq" Version="4.17.2" />
<PackageReference Include="Shouldly" Version="4.0.3" />
<PackageReference Include="xunit" Version="2.4.1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Widgets.Server\Widgets.Server.csproj" />
</ItemGroup>
<ItemGroup>
<None Update="appsettings.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>
設定.json
在與服務器檔案夾位于同一級別的 .vscode 檔案夾中,這是設定檔案包含的內容:(就測驗專案的路徑而言,這是正確的)
{
"dotnet-test-explorer.testProjectPath": "Widgets.Server.Tests/Widgets.Server.Tests.csproj"
}
無法讀取屬性錯誤
手動運行測驗
當我打開一個特定的測驗類并運行它時,它似乎可以作業。請看下圖:
編輯 1
我注意到的另一個行為是,當我第一次打開 VSCOde 時,它??會找到所有測驗并在底部狀態欄列出總數。但有時,當我嘗試只除錯一個測驗時,我會收到以下錯誤:
Failed to start debugger: "System.InvalidOperationException: The debugger could not be started\r\n at OmniSharp.DotNetTest.Services.DebugTestService.Handle(DebugTestGetStartInfoRequest request) in D:\\a\\1\\s\\src\\OmniSharp.DotNetTest\\Services\\DebugTestService.cs:line 42\r\n at OmniSharp.Endpoint.EndpointHandler`2.GetFirstNotEmptyResponseFromHandlers(ExportHandler`2[] handlers, TRequest request) in D:\\a\\1\\s\\src\\OmniSharp.Host\\Endpoint\\EndpointHandler.cs:line 198\r\n at OmniSharp.Endpoint.EndpointHandler`2.HandleRequestForLanguage(String language, TRequest request, RequestPacket packet) in D:\\a\\1\\s\\src\\OmniSharp.Host\\Endpoint\\EndpointHandler.cs:line 234\r\n at OmniSharp.Endpoint.EndpointHandler`2.Process(RequestPacket packet, LanguageModel model, JToken requestObject) in D:\\a\\1\\s\\src\\OmniSharp.Host\\Endpoint\\EndpointHandler.cs:line 143\r\n at OmniSharp.Stdio.Host.HandleRequest(String json, ILogger logger) in D:\\a\\1\\s\\src\\OmniSharp.Stdio\\Host.cs:line 258"
在輸出視窗中我看到了這個:
----- Debugging test method Widgets.Server.Tests.FeatureToggleSampleControllerShould.Return_String_If_Toggle_Enabled -----
MSBuild version 17.3.0 92e077650 for .NET
C:\Program Files\dotnet\sdk\6.0.400\Microsoft.Common.CurrentVersion.targets(4809,5): error MSB3021: Unable to copy file "C:\Users\me\.nuget\packages\microsoft.testplatform.objectmodel\17.1.0\lib\netcoreapp2.1\Microsoft.TestPlatform.PlatformAbstractions.dll" to "bin\Debug\net5.0-windows\Microsoft.TestPlatform.PlatformAbstractions.dll". The process cannot access the file 'c:\Users\me\Documents\src\codeReview\widgets\server\Widgets.Server.Tests\bin\Debug\net5.0-windows\Microsoft.TestPlatform.PlatformAbstractions.dll' because it is being used by another process. [c:\Users\me\Documents\src\codeReview\widgets\server\Widgets.Server.Tests\Jw.O3M.Server.Tests.csproj]
10 Warning(s)
2 Error(s)
發生這種情況時,我必須洗掉 Test 專案中的 bin 檔案夾,還要找到并終止 testhost 行程。然后我可以通過單擊 [Fact] 裝飾器下的“運行測驗|除錯測驗”選項來運行單個測驗
但是測驗資源管理器仍然是空的。無論我做什么,我都無法顯示測驗串列。
uj5u.com熱心網友回復:
這是測驗資源管理器擴展中的一個已知問題,請參閱https://github.com/formulahendry/vscode-dotnet-test-explorer/issues/370
一種解決方法是在“平面”樹模式視圖中顯示測驗: VSCode 中的設定截圖
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/504765.html
下一篇:資料庫原理基礎一