Ich starte Integrationstests mit „dotnet test“. Sie erzeugen IIS Express, das NUR in der CI-Pipeline fehlschlägt, wenn iC#

Ein Treffpunkt für C#-Programmierer
Anonymous
 Ich starte Integrationstests mit „dotnet test“. Sie erzeugen IIS Express, das NUR in der CI-Pipeline fehlschlägt, wenn i

Post by Anonymous »

Der Test mit Abdeckung läuft lokal einwandfrei:

Code: Select all

C:\xyz\DevOps\xyz.DependencyInjection [master ≡]> dotnet test -c:Release --no-build -f net9.0 --filter "FullyQualifiedName~Tests.IntegrationTests.GetBinDir" --collect "Code coverage" -s ..\cicd-templates\ci\CodeCoverage.runsettings
[xUnit.net 00:00:00.00] xUnit.net VSTest Adapter v2.4.5+1caef2f33e (64-bit .NET 9.0.11)
[xUnit.net 00:00:01.50]   Discovering: Tests (method display = ClassAndMethod, method display options = None)
[xUnit.net 00:00:01.54]   Discovered:  Tests (found 18 test cases)
[xUnit.net 00:00:01.55]   Starting:    Tests (parallel test collections = on, max threads = 22)
[xUnit.net 00:00:18.55]   Finished:    Tests
Tests test net9.0 succeeded with 87 warning(s) (21.4s)
C:\Program Files\dotnet\sdk\9.0.306\Microsoft.TestPlatform.targets(48,5): warning : [xUnit.net 00:00:01.59] Tests: Current directory: C:\xyz\DevOps\xyz.DependencyInjection\tests\tests\bin\Release\net9.0
C:\Program Files\dotnet\sdk\9.0.306\Microsoft.TestPlatform.targets(48,5): warning : [xUnit.net 00:00:01.59] Tests: Found solution directory: C:\xyz\DevOps\xyz.DependencyInjection
C:\Program Files\dotnet\sdk\9.0.306\Microsoft.TestPlatform.targets(48,5): warning : [xUnit.net 00:00:01.59] Tests: Starting 3 IIS Express instances...
C:\Program Files\dotnet\sdk\9.0.306\Microsoft.TestPlatform.targets(48,5): warning : [xUnit.net 00:00:01.61] Tests: Starting IIS Express on port 51842 for C:\xyz\DevOps\xyz.DependencyInjection\tests\AspNetTest
C:\Program Files\dotnet\sdk\9.0.306\Microsoft.TestPlatform.targets(48,5): warning : [xUnit.net 00:00:01.68] Tests: Waiting for http://localhost:51842/AspNetTest/ping to be available
C:\Program Files\dotnet\sdk\9.0.306\Microsoft.TestPlatform.targets(48,5): warning : [xUnit.net 00:00:01.78] Tests: Starting IIS Express on port 60623 for C:\xyz\DevOps\xyz.DependencyInjection\tests\WebApiTest
C:\Program Files\dotnet\sdk\9.0.306\Microsoft.TestPlatform.targets(48,5): warning : [xUnit.net 00:00:01.82] Tests: Waiting for http://localhost:60623/WebApiTest/ping to be available
C:\Program Files\dotnet\sdk\9.0.306\Microsoft.TestPlatform.targets(48,5): warning : [xUnit.net 00:00:01.83] Tests: Starting IIS Express on port 60624 for C:\xyz\DevOps\xyz.DependencyInjection\tests\WcfTest
C:\Program Files\dotnet\sdk\9.0.306\Microsoft.TestPlatform.targets(48,5): warning : [xUnit.net 00:00:01.86] Tests: Waiting for http://localhost:60624/TestService.svc/ping to be available
C:\Program Files\dotnet\sdk\9.0.306\Microsoft.TestPlatform.targets(48,5): warning : [xUnit.net 00:00:02.04] Tests: [IIS] [51842] Starting IIS Express ...
C:\Program Files\dotnet\sdk\9.0.306\Microsoft.TestPlatform.targets(48,5): warning : [xUnit.net 00:00:02.13] Tests: [IIS] [60623] Starting IIS Express ...
C:\Program Files\dotnet\sdk\9.0.306\Microsoft.TestPlatform.targets(48,5): warning : [xUnit.net 00:00:02.13] Tests: [IIS] [60624] Starting IIS Express ...
C:\Program Files\dotnet\sdk\9.0.306\Microsoft.TestPlatform.targets(48,5): warning : [xUnit.net 00:00:02.33] Tests: [IIS] [51842] Successfully registered URL "http://localhost:51842/" for site "Development Web Site" application "/"
C:\Program Files\dotnet\sdk\9.0.306\Microsoft.TestPlatform.targets(48,5): warning : [xUnit.net 00:00:02.33] Tests: [IIS] [51842] Registration completed
C:\Program Files\dotnet\sdk\9.0.306\Microsoft.TestPlatform.targets(48,5): warning : [xUnit.net 00:00:02.33] Tests: [IIS] [51842] IIS Express is running.
C:\Program Files\dotnet\sdk\9.0.306\Microsoft.TestPlatform.targets(48,5): warning : [xUnit.net 00:00:02.41] Tests: [IIS] [60624] Successfully registered URL "http://localhost:60624/" for site "Development Web Site" application "/"
C:\Program Files\dotnet\sdk\9.0.306\Microsoft.TestPlatform.targets(48,5): warning : [xUnit.net 00:00:02.41] Tests: [IIS] [60624] Registration completed
C:\Program Files\dotnet\sdk\9.0.306\Microsoft.TestPlatform.targets(48,5): warning : [xUnit.net 00:00:02.41] Tests: [IIS] [60624] IIS Express is running.
C:\Program Files\dotnet\sdk\9.0.306\Microsoft.TestPlatform.targets(48,5): warning : [xUnit.net 00:00:02.43] Tests: [IIS] [60623] Successfully registered URL "http://localhost:60623/" for site "Development Web Site"  application "/"
C:\Program Files\dotnet\sdk\9.0.306\Microsoft.TestPlatform.targets(48,5): warning : [xUnit.net 00:00:02.43] Tests: [IIS] [60623] Registration completed
C:\Program Files\dotnet\sdk\9.0.306\Microsoft.TestPlatform.targets(48,5): warning : [xUnit.net 00:00:02.43] Tests: [IIS] [60623] IIS Express is running.
C:\Program Files\dotnet\sdk\9.0.306\Microsoft.TestPlatform.targets(48,5): warning : [xUnit.net 00:00:03.70] Tests: Attempt 1 out of 30 - server not ready - The request was canceled due to the configured HttpClient.Timeout of 2 seconds elapsing.
C:\Program Files\dotnet\sdk\9.0.306\Microsoft.TestPlatform.targets(48,5): warning : [xUnit.net 00:00:03.84] Tests: Attempt 1 out of 30 - server not ready - The request was canceled due to the configured HttpClient.Timeout of 2 seconds elapsing.
C:\Program Files\dotnet\sdk\9.0.306\Microsoft.TestPlatform.targets(48,5): warning : [xUnit.net 00:00:03.88] Tests: Attempt 1 out of 30 - server not ready - The request was canceled due to the configured HttpClient.Timeout of 2 seconds elapsing.
C:\Program Files\dotnet\sdk\9.0.306\Microsoft.TestPlatform.targets(48,5): warning : [xUnit.net 00:00:06.72] Tests: Attempt 2 out of 30 - server not ready - The request was canceled due to the configured HttpClient.Timeout of 2 seconds elapsing.
C:\Program Files\dotnet\sdk\9.0.306\Microsoft.TestPlatform.targets(48,5): warning : [xUnit.net 00:00:06.84] Tests: Attempt 2 out of 30 - server not ready - The request was canceled due to the configured HttpClient.Timeout of 2 seconds elapsing.
C:\Program Files\dotnet\sdk\9.0.306\Microsoft.TestPlatform.targets(48,5): warning : [xUnit.net 00:00:06.89] Tests: Attempt 2 out of 30 - server not ready - The request was canceled due to the configured HttpClient.Timeout of 2 seconds elapsing.
C:\Program Files\dotnet\sdk\9.0.306\Microsoft.TestPlatform.targets(48,5): warning : [xUnit.net 00:00:09.73] Tests: Attempt 3 out of 30 - server not ready - The request was canceled due to the configured HttpClient.Timeout of 2 seconds elapsing.
C:\Program Files\dotnet\sdk\9.0.306\Microsoft.TestPlatform.targets(48,5): warning : [xUnit.net 00:00:09.86] Tests: Attempt 3 out of 30 - server not ready - The request was canceled due to the configured HttpClient.Timeout of 2 seconds elapsing.
C:\Program Files\dotnet\sdk\9.0.306\Microsoft.TestPlatform.targets(48,5): warning : [xUnit.net 00:00:09.91] Tests: Attempt 3 out of 30 - server not ready - The request was canceled due to the configured HttpClient.Timeout of 2 seconds elapsing.
C:\Program Files\dotnet\sdk\9.0.306\Microsoft.TestPlatform.targets(48,5): warning : [xUnit.net 00:00:12.73] Tests: Attempt 4 out of 30 - server not ready - The request was canceled due to the configured HttpClient.Timeout of 2 seconds elapsing.
C:\Program Files\dotnet\sdk\9.0.306\Microsoft.TestPlatform.targets(48,5): warning : [xUnit.net 00:00:12.87] Tests: Attempt 4 out of 30 - server not ready - The request was canceled due to the configured HttpClient.Timeout of 2 seconds elapsing.
C:\Program Files\dotnet\sdk\9.0.306\Microsoft.TestPlatform.targets(48,5): warning : [xUnit.net 00:00:12.91] Tests: Attempt 4 out of 30 - server not ready - The request was canceled due to the configured HttpClient.Timeout of 2 seconds elapsing.
C:\Program Files\dotnet\sdk\9.0.306\Microsoft.TestPlatform.targets(48,5): warning : [xUnit.net 00:00:13.90] Tests: [IIS] [51842] Request started: "GET" http://localhost:51842/AspNetTest/ping
C:\Program Files\dotnet\sdk\9.0.306\Microsoft.TestPlatform.targets(48,5): warning : [xUnit.net 00:00:13.90] Tests: [IIS] [51842] Request started: "GET" http://localhost:51842/AspNetTest/ping
C:\Program Files\dotnet\sdk\9.0.306\Microsoft.TestPlatform.targets(48,5): warning : [xUnit.net 00:00:13.97] Tests: [IIS] [51842] Request started: "GET" http://localhost:51842/AspNetTest/ping
C:\Program Files\dotnet\sdk\9.0.306\Microsoft.TestPlatform.targets(48,5): warning : [xUnit.net 00:00:13.97] Tests: [IIS] [51842] Request started: "GET" http://localhost:51842/AspNetTest/ping
C:\Program Files\dotnet\sdk\9.0.306\Microsoft.TestPlatform.targets(48,5): warning : [xUnit.net 00:00:14.00] Tests: [IIS] [51842] Request started: "GET" http://localhost:51842/AspNetTest/ping
C:\Program Files\dotnet\sdk\9.0.306\Microsoft.TestPlatform.targets(48,5): warning : [xUnit.net 00:00:14.14] Tests: [IIS] [60623] Request started: "GET" http://localhost:60623/WebApiTest/ping
C:\Program Files\dotnet\sdk\9.0.306\Microsoft.TestPlatform.targets(48,5): warning : [xUnit.net 00:00:14.19] Tests: [IIS] [60623] Request started: "GET"  http://localhost:60623/WebApiTest/ping
C:\Program Files\dotnet\sdk\9.0.306\Microsoft.TestPlatform.targets(48,5): warning : [xUnit.net 00:00:14.23] Tests: [IIS] [60623] Request started: "GET" http://localhost:60623/WebApiTest/ping
C:\Program Files\dotnet\sdk\9.0.306\Microsoft.TestPlatform.targets(48,5): warning : [xUnit.net 00:00:14.23] Tests: [IIS] [60623] Request started: "GET" http://localhost:60623/WebApiTest/ping
C:\Program Files\dotnet\sdk\9.0.306\Microsoft.TestPlatform.targets(48,5): warning : [xUnit.net 00:00:14.23] Tests: [IIS] [60623] Request started: "GET" http://localhost:60623/WebApiTest/ping
C:\Program Files\dotnet\sdk\9.0.306\Microsoft.TestPlatform.targets(48,5): warning : [xUnit.net 00:00:15.27] Tests: [IIS] [60624] Request started: "GET" http://localhost:60624/TestService.svc/ping
C:\Program Files\dotnet\sdk\9.0.306\Microsoft.TestPlatform.targets(48,5): warning : [xUnit.net 00:00:15.29] Tests: [IIS] [60624] Request started: "GET" http://localhost:60624/TestService.svc/ping
C:\Program Files\dotnet\sdk\9.0.306\Microsoft.TestPlatform.targets(48,5): warning : [xUnit.net 00:00:15.29] Tests: [IIS] [60624] Request started: "GET" http://localhost:60624/TestService.svc/ping
C:\Program Files\dotnet\sdk\9.0.306\Microsoft.TestPlatform.targets(48,5): warning : [xUnit.net 00:00:15.33] Tests: [IIS] [60624] Request started: "GET" http://localhost:60624/TestService.svc/ping
C:\Program Files\dotnet\sdk\9.0.306\Microsoft.TestPlatform.targets(48,5): warning : [xUnit.net 00:00:15.37] Tests: [IIS] [60624] Request started: "GET" http://localhost:60624/TestService.svc/ping
C:\Program Files\dotnet\sdk\9.0.306\Microsoft.TestPlatform.targets(48,5): warning : [xUnit.net 00:00:15.67] Tests: [IIS] [51842] Response sent: http://localhost:51842/AspNetTest/ping with HTTP status 200.0
C:\Program Files\dotnet\sdk\9.0.306\Microsoft.TestPlatform.targets(48,5): warning : [xUnit.net 00:00:15.67] Tests: [IIS] [51842] Response sent: http://localhost:51842/AspNetTest/ping with HTTP status 200.0
C:\Program Files\dotnet\sdk\9.0.306\Microsoft.TestPlatform.targets(48,5): warning : [xUnit.net 00:00:15.67] Tests: [IIS] [51842] Response sent: http://localhost:51842/AspNetTest/ping with HTTP status 200.0
C:\Program Files\dotnet\sdk\9.0.306\Microsoft.TestPlatform.targets(48,5): warning : [xUnit.net 00:00:15.67] Tests: [IIS] [51842] Response sent: http://localhost:51842/AspNetTest/ping with HTTP status 200.0
C:\Program Files\dotnet\sdk\9.0.306\Microsoft.TestPlatform.targets(48,5): warning : [xUnit.net 00:00:15.67] Tests: [IIS] [51842] Response sent: http://localhost:51842/AspNetTest/ping with HTTP status 200.0
C:\Program Files\dotnet\sdk\9.0.306\Microsoft.TestPlatform.targets(48,5): warning : [xUnit.net 00:00:15.68] Tests: Server ready after 5 attempts
C:\Program Files\dotnet\sdk\9.0.306\Microsoft.TestPlatform.targets(48,5): warning : [xUnit.net 00:00:15.87] Tests: Attempt 5 out of 30 - server not ready - The request was canceled due to the configured HttpClient.Timeout of 2 seconds elapsing.
C:\Program Files\dotnet\sdk\9.0.306\Microsoft.TestPlatform.targets(48,5): warning : [xUnit.net 00:00:15.92] Tests: Attempt 5 out of 30 - server not ready - The request was canceled due to the configured HttpClient.Timeout of 2 seconds elapsing.
C:\Program Files\dotnet\sdk\9.0.306\Microsoft.TestPlatform.targets(48,5): warning : [xUnit.net 00:00:16.15] Tests: [IIS] [60623] Response sent: http://localhost:60623/WebApiTest/ping with HTTP status 500.0
C:\Program Files\dotnet\sdk\9.0.306\Microsoft.TestPlatform.targets(48,5): warning : [xUnit.net 00:00:16.15] Tests: [IIS] [60623] Response sent: http://localhost:60623/WebApiTest/ping with HTTP status 500.0
C:\Program Files\dotnet\sdk\9.0.306\Microsoft.TestPlatform.targets(48,5): warning : [xUnit.net 00:00:16.15] Tests: [IIS] [60623] Response sent: http://localhost:60623/WebApiTest/ping with HTTP status 500.0
C:\Program Files\dotnet\sdk\9.0.306\Microsoft.TestPlatform.targets(48,5): warning : [xUnit.net 00:00:16.15] Tests: [IIS] [60623] Response sent: http://localhost:60623/WebApiTest/ping with HTTP status 500.0
C:\Program Files\dotnet\sdk\9.0.306\Microsoft.TestPlatform.targets(48,5): warning : [xUnit.net 00:00:16.15] Tests: [IIS] [60623] Response sent: http://localhost:60623/WebApiTest/ping with HTTP status 500.0
C:\Program Files\dotnet\sdk\9.0.306\Microsoft.TestPlatform.targets(48,5): warning : [xUnit.net 00:00:16.87] Tests: [IIS] [60623] Request started: "GET"  http://localhost:60623/WebApiTest/ping
C:\Program Files\dotnet\sdk\9.0.306\Microsoft.TestPlatform.targets(48,5): warning : [xUnit.net 00:00:16.90] Tests: [IIS] [60623] Response sent: http://localhost:60623/WebApiTest/ping with HTTP status 204.0
C:\Program Files\dotnet\sdk\9.0.306\Microsoft.TestPlatform.targets(48,5): warning : [xUnit.net 00:00:16.90] Tests: Server ready after 6 attempts
C:\Program Files\dotnet\sdk\9.0.306\Microsoft.TestPlatform.targets(48,5): warning : [xUnit.net 00:00:16.94] Tests: [IIS] [60624] Request started: "GET" http://localhost:60624/TestService.svc/ping
C:\Program Files\dotnet\sdk\9.0.306\Microsoft.TestPlatform.targets(48,5): warning : [xUnit.net 00:00:16.96] Tests: [IIS] [60624] Response sent: http://localhost:60624/TestService.svc/ping with HTTP status 200.0
C:\Program Files\dotnet\sdk\9.0.306\Microsoft.TestPlatform.targets(48,5): warning : [xUnit.net 00:00:16.96] Tests: [IIS] [60624] Response sent: http://localhost:60624/TestService.svc/ping with HTTP status 200.0
C:\Program Files\dotnet\sdk\9.0.306\Microsoft.TestPlatform.targets(48,5): warning : [xUnit.net 00:00:16.96] Tests: [IIS] [60624] Response sent: http://localhost:60624/TestService.svc/ping with HTTP status 200.0
C:\Program Files\dotnet\sdk\9.0.306\Microsoft.TestPlatform.targets(48,5): warning : [xUnit.net 00:00:16.97] Tests: [IIS] [60624] Response sent: http://localhost:60624/TestService.svc/ping with HTTP status 200.0
C:\Program Files\dotnet\sdk\9.0.306\Microsoft.TestPlatform.targets(48,5): warning : [xUnit.net 00:00:16.97] Tests: [IIS] [60624] Response sent: http://localhost:60624/TestService.svc/ping with HTTP status 200.0
C:\Program Files\dotnet\sdk\9.0.306\Microsoft.TestPlatform.targets(48,5): warning : [xUnit.net 00:00:16.97] Tests: [IIS] [60624] Response sent: http://localhost:60624/TestService.svc/ping with HTTP status 200.0
C:\Program Files\dotnet\sdk\9.0.306\Microsoft.TestPlatform.targets(48,5): warning : [xUnit.net 00:00:16.97] Tests: Server ready after 6 attempts
C:\Program Files\dotnet\sdk\9.0.306\Microsoft.TestPlatform.targets(48,5): warning : [xUnit.net 00:00:17.01] Tests: [IIS] [51842] Request started: "GET" http://localhost:51842/AspNetTest/GetBinDir
C:\Program Files\dotnet\sdk\9.0.306\Microsoft.TestPlatform.targets(48,5): warning : [xUnit.net 00:00:17.03] Tests: [IIS] [51842] Response sent: http://localhost:51842/AspNetTest/GetBinDir with HTTP status 200.0
C:\Program Files\dotnet\sdk\9.0.306\Microsoft.TestPlatform.targets(48,5): warning : [xUnit.net 00:00:17.05] Tests: [IIS] [60624] Request started: "GET" http://localhost:60624/TestService.svc/GetBinDir
C:\Program Files\dotnet\sdk\9.0.306\Microsoft.TestPlatform.targets(48,5): warning : [xUnit.net 00:00:17.19] Tests: [IIS] [60624] Response sent: http://localhost:60624/TestService.svc/GetBinDir with HTTP status 200.0
C:\Program Files\dotnet\sdk\9.0.306\Microsoft.TestPlatform.targets(48,5): warning : [xUnit.net 00:00:17.20] Tests: [IIS] [60623] Request started: "GET"  http://localhost:60623/WebApiTest/GetBinDir
C:\Program Files\dotnet\sdk\9.0.306\Microsoft.TestPlatform.targets(48,5): warning : [xUnit.net 00:00:17.36] Tests: [IIS] [60623] Response sent: http://localhost:60623/WebApiTest/GetBinDir with HTTP status 200.0
C:\Program Files\dotnet\sdk\9.0.306\Microsoft.TestPlatform.targets(48,5): warning : [xUnit.net 00:00:17.36] Tests: [IIS] [60623] Response sent: http://localhost:60623/WebApiTest/GetBinDir with HTTP status 200.0
C:\Program Files\dotnet\sdk\9.0.306\Microsoft.TestPlatform.targets(48,5): warning : [xUnit.net 00:00:17.37] Tests: Disposing AllWebFrameworksFixture - stopping all IIS Express instances...
C:\Program Files\dotnet\sdk\9.0.306\Microsoft.TestPlatform.targets(48,5): warning : [xUnit.net 00:00:17.82] Tests: Stopping IIS Express for: C:\xyz\DevOps\xyz.DependencyInjection\tests\AspNetTest on port 51842
C:\Program Files\dotnet\sdk\9.0.306\Microsoft.TestPlatform.targets(48,5): warning : [xUnit.net 00:00:17.89] Tests: IIS Express stopped
C:\Program Files\dotnet\sdk\9.0.306\Microsoft.TestPlatform.targets(48,5): warning : [xUnit.net 00:00:18.14] Tests: Stopping IIS Express for: C:\xyz\DevOps\xyz.DependencyInjection\tests\WebApiTest on port 60623
C:\Program Files\dotnet\sdk\9.0.306\Microsoft.TestPlatform.targets(48,5): warning : [xUnit.net 00:00:18.20] Tests: IIS Express stopped
C:\Program Files\dotnet\sdk\9.0.306\Microsoft.TestPlatform.targets(48,5): warning : [xUnit.net 00:00:18.49] Tests: Stopping IIS Express for: C:\xyz\DevOps\xyz.DependencyInjection\tests\WcfTest on port 60624
C:\Program Files\dotnet\sdk\9.0.306\Microsoft.TestPlatform.targets(48,5): warning : [xUnit.net 00:00:18.55] Tests: IIS Express stopped
C:\Program Files\dotnet\sdk\9.0.306\Microsoft.TestPlatform.targets(48,5): warning : [xUnit.net 00:00:18.55] Tests: All IIS Express instances stopped

Test summary: total: 3, failed: 0, succeeded: 3, skipped: 0, duration: 21.3s
Build succeeded with 87 warning(s) in 21.8s

Attachments:
C:\xyz\DevOps\xyz.DependencyInjection\tests\tests\TestResults\cb066865-80fe-4d62-b8f9-a4c7cf449290\c4d34f0e-d56b-4a0b-b744-17a1c00b38e3.coverage
C:\xyz\DevOps\xyz.DependencyInjection [master ≡ +1 ~0 -0 !]>
Dies sind Integrationstests. Sie erzeugen drei Instanzen von IIS Express – eine für einen Asp.Net-Test, eine für einen WebApi-Test und die letzte für einen WCF-Test. Der Testcode führt Webanfragen an die jeweilige Webanwendung durch und bestätigt die Antworten.
Wenn dies nun in einer CI-Pipeline ausgeführt wird, wird keiner der IIS-Server als bereit gemeldet, da die Ping-Zustandsprüfungs-URL (die leeren Inhalt zurückgibt) fehlschlägt. Laut Build-Protokoll ist der Fehler derselbe, nur der Einstiegspunkt der Webanwendung ist unterschiedlich, z. B.:

Code: Select all

[FileNotFoundException: Could not load file or assembly 'Microsoft.VisualStudio.CodeCoverage.Shim, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.]
WcfTest.Global.Application_Start(Object sender, EventArgs e) in D:\_wfaz\07\64\s\xyz.DependencyInjection\tests\WcfTest\Global.asax.cs:14

[HttpException (0x80004005): Could not load file or assembly 'Microsoft.VisualStudio.CodeCoverage.Shim, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.]
System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +517
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +185
System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +168
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +277
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +369

[HttpException (0x80004005): Could not load file or assembly 'Microsoft.VisualStudio.CodeCoverage.Shim, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies.  The system cannot find the file specified.]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +532
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +111
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +724
Die von mir verwendete Runsettings-Datei ist:

Code: Select all











.*\.(?:(?:Unit|Integration)?Tests|Views)\.(?:dll|exe)





xyz HCM Holding, Inc.





^System\.Diagnostics\.DebuggerHiddenAttribute$
^System\.Diagnostics\.DebuggerNonUserCodeAttribute$
^System\.CodeDom\.Compiler\.GeneratedCodeAttribute$
^System\.Diagnostics\.CodeAnalysis\.ExcludeFromCodeCoverageAttribute$



True
True
True
True






Ich habe versucht, CollectAspDotNet auf „false“ zu setzen, aber es hat nichts geändert.
Hier ist die Haupttestprojektdatei:

Code: Select all



net472;net9.0
enable
true







runtime; build; native; contentfiles; analyzers; buildtransitive
all












PreserveNewest




xunit.runner.json:

Code: Select all

{
"$schema": "https://xunit.net/schema/current/xunit.runner.schema.json",
"diagnosticMessages": true
}
Und eines der Webanwendungsprojekte:

Code: Select all


net472
true
Overwrite























Die Webanwendungen selbst sind Teil der Testumgebung, aber sie hängen von den Produktionsprojekten ab und ich bin wirklich daran interessiert, den Produktionscode im echten Webanwendungskontext auszuprobieren.
Beachten Sie, dass ich .NET Framework unterstützen muss.
Wie kann ich das Problem richtig beheben?
BEARBEITEN 1
Ich habe sichergestellt, dass die Shim-DLL fehlt in das bin-Verzeichnis kopiert und jetzt ist der Fehler:

Code: Select all

[COMException (0x80040154): Retrieving the COM class factory for component with CLSID {A9E69610-B80D-11D0-B9B9-00A0C922E750} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).]
System.Runtime.AsyncResult.End(IAsyncResult result) +575
System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result) +240
System.ServiceModel.Activation.ServiceHttpModule.EndProcessRequest(IAsyncResult ar) +39
System.Web.AsyncEventExecutionStep.InvokeEndHandler(IAsyncResult ar) +225
System.Web.AsyncEventExecutionStep.OnAsyncEventCompletion(IAsyncResult ar) +162
BEARBEITEN 2
Es scheint, als ob IIS Express von COM-Komponenten abhängt. Es sieht nicht so aus, als ob es für den Zweck des jeweiligen Builds durch eine CI-Pipeline installiert werden soll. Das mache ich derzeit in meiner Pipeline mit einem Skript wie diesem:

Code: Select all

param(
$AgentToolsDirectory = $env:AGENT_TOOLSDIRECTORY,
$AgentTempDirectory = $env:AGENT_TEMPDIRECTORY
)

$agentToolsDir = Join-Path $AgentToolsDirectory "IISExpress"
$iisExpressExe = Join-Path $agentToolsDir "iisexpress.exe"

if (Test-Path $iisExpressExe)
{
exit 0
}

$installerUrl = "https://download.microsoft.com/download/c/e/8/ce8d18f5-d4c0-45b5-b531-adecd637a1aa/iisexpress_amd64_en-US.msi"
$installerPath = Join-Path $AgentTempDirectory "iisexpress_amd64_en-US.msi"

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

$ProgressPreference = 'SilentlyContinue'
Invoke-WebRequest -Uri $installerUrl -OutFile $installerPath -UseBasicParsing

$extractDir = Join-Path $AgentTempDirectory $([guid]::NewGuid().ToString("N"))
New-Item -ItemType Directory -Force -Path $extractDir | Out-Null

$extractArgs = "/a `"$installerPath`" /qn TARGETDIR=`"$extractDir`""
Start-Process "msiexec.exe" -ArgumentList $extractArgs -Wait -NoNewWindow

$programFilesDir = Get-ChildItem -Path $extractDir -Recurse -Directory -Filter "IIS Express" | Select-Object -First 1

if ($programFilesDir)
{
Move-Item -Path $programFilesDir.FullName -Destination $agentToolsDir -Force
}
else
{
exit 1
}

Remove-Item -Path $extractDir -Recurse -Force -ErrorAction SilentlyContinue

if (!(Test-Path $iisExpressExe))
{
exit 1
}
Was grundsätzlich falsch zu sein scheint.
Es stellt sich also die Frage, welchen CI-Pipeline-freundlichen Webserver ich installieren kann, der .NET Framework-Webanwendungen unterstützt? Es muss .NET Framework sein.

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post