I'm sometimes hitting a null ref when running an integration test using DistributedApplicationTestingBuilder. Output from is below:
info [Aspire.Hosting.DistributedApplication] Aspire version: 8.0.0-preview.5.24178.1+590f3f712786fe3fd6a24b492cc3c236bc15075b
info [Aspire.Hosting.DistributedApplication] Distributed application starting.
info [Aspire.Hosting.DistributedApplication] Application host directory is: D:\src\GitHub\dotnet\aspire-samples\samples\DatabaseContainers\DatabaseContainers.AppHost
fail [Aspire.Hosting.Dcp.ApplicationExecutor] Error streaming logs for catalog_50fed39e
System.NullReferenceException: Object reference not set to an instance of an object.
at k8s.Kubernetes.SendRequestRaw(String requestContent, HttpRequestMessage httpRequest, CancellationToken cancellationToken)
at Aspire.Hosting.Dcp.DcpKubernetesClient.ReadSubResourceAsStreamAsync(String group, String version, String plural, String name, String subResource, String namespaceParameter, IReadOnlyCollection`1 queryParams, CancellationToken cancellationToken) in /_/src/Aspire.Hosting/Dcp/DcpKubernetesClient.cs:line 71
at Aspire.Hosting.Dcp.KubernetesService.<>c__DisplayClass16_0`1.<<GetLogStreamAsync>b__0>d.MoveNext() in /_/src/Aspire.Hosting/Dcp/KubernetesService.cs:line 202
--- End of stack trace from previous location ---
at Aspire.Hosting.Dcp.KubernetesService.ExecuteWithRetry[TResult](DcpApiOperationType operationType, String resourceType, Func`2 operation, CancellationToken cancellationToken)
at Aspire.Hosting.Dcp.ResourceLogSource`1.GetAsyncEnumerator(CancellationToken cancellationToken)+MoveNext() in /_/src/Aspire.Hosting/Dcp/ResourceLogSource.cs:line 28
at Aspire.Hosting.Dcp.ResourceLogSource`1.GetAsyncEnumerator(CancellationToken cancellationToken)+System.Threading.Tasks.Sources.IValueTaskSource<System.Boolean>.GetResult()
at Aspire.Hosting.Dcp.ApplicationExecutor.<>c__DisplayClass34_1`1.<<StartLogStream>b__1>d.MoveNext() in /_/src/Aspire.Hosting/Dcp/ApplicationExecutor.cs:line 370
--- End of stack trace from previous location ---
at Aspire.Hosting.Dcp.ApplicationExecutor.<>c__DisplayClass34_1`1.<<StartLogStream>b__1>d.MoveNext() in /_/src/Aspire.Hosting/Dcp/ApplicationExecutor.cs:line 370
info [Aspire.Hosting.Dcp.DcpHostService] Starting DCP with arguments: start-apiserver --monitor 169004 --detach --kubeconfig "C:\Users\dedward\AppData\Local\Temp\aspire.ott12obl.cxx\kubeconfig"
fail [Aspire.Hosting.Dcp.ApplicationExecutor] Error streaming logs for basketcache_50fed39e
System.NullReferenceException: Object reference not set to an instance of an object.
at k8s.Kubernetes.SendRequestRaw(String requestContent, HttpRequestMessage httpRequest, CancellationToken cancellationToken)
at Aspire.Hosting.Dcp.DcpKubernetesClient.ReadSubResourceAsStreamAsync(String group, String version, String plural, String name, String subResource, String namespaceParameter, IReadOnlyCollection`1 queryParams, CancellationToken cancellationToken) in /_/src/Aspire.Hosting/Dcp/DcpKubernetesClient.cs:line 71
at Aspire.Hosting.Dcp.KubernetesService.<>c__DisplayClass16_0`1.<<GetLogStreamAsync>b__0>d.MoveNext() in /_/src/Aspire.Hosting/Dcp/KubernetesService.cs:line 202
--- End of stack trace from previous location ---
at Aspire.Hosting.Dcp.KubernetesService.ExecuteWithRetry[TResult](DcpApiOperationType operationType, String resourceType, Func`2 operation, CancellationToken cancellationToken)
at Aspire.Hosting.Dcp.ResourceLogSource`1.GetAsyncEnumerator(CancellationToken cancellationToken)+MoveNext() in /_/src/Aspire.Hosting/Dcp/ResourceLogSource.cs:line 28
at Aspire.Hosting.Dcp.ResourceLogSource`1.GetAsyncEnumerator(CancellationToken cancellationToken)+System.Threading.Tasks.Sources.IValueTaskSource<System.Boolean>.GetResult()
at Aspire.Hosting.Dcp.ApplicationExecutor.<>c__DisplayClass34_1`1.<<StartLogStream>b__1>d.MoveNext() in /_/src/Aspire.Hosting/Dcp/ApplicationExecutor.cs:line 370
--- End of stack trace from previous location ---
at Aspire.Hosting.Dcp.ApplicationExecutor.<>c__DisplayClass34_1`1.<<StartLogStream>b__1>d.MoveNext() in /_/src/Aspire.Hosting/Dcp/ApplicationExecutor.cs:line 370
info [Aspire.Hosting.Dcp.start-apiserver.api-server] Starting API server...
info [Aspire.Hosting.Dcp.start-apiserver.api-server] API server started {"Address": "::1", "Port": 52479}
info [Aspire.Hosting.Dcp.start-apiserver.dcp-host] Starting DCP controller host
info [Aspire.Hosting.Dcp.start-apiserver.dcp-host] Started all services {"count": 1}
info [Aspire.Hosting.Dcp.dcpctrl.IdeExecutableRunner] Executables cannot be started via IDE: missing required environment variable 'DEBUG_SESSION_PORT'
info [Aspire.Hosting.Dcp.dcpctrl] starting controller manager
Resource 'Todos' state: Starting
Resource 'catalog' state: Starting
Resource 'sqlserver' state: Hidden
Resource 'mysql' state: Hidden
Resource 'AddressBook' state: Starting
Resource 'apiservice' state: Starting
Resource 'postgres' state: Hidden
info [Aspire.Hosting.DistributedApplication] Distributed application started. Press Ctrl+C to shut down.
info [Aspire.Hosting.Dcp.dcpctrl.ContainerReconciler] no more Container resources are being watched, cancelling container watch {"Container": {"name":"postgres_4bea9e70"}, "Reconciliation": 4}
info [Aspire.Hosting.Dcp.dcpctrl.ContainerReconciler] no more Container resources are being watched, cancelling container watch {"Container": {"name":"mysql_4bea9e70"}, "Reconciliation": 5}
Repro details
Visual Studio 2022 Int Preview 17.10.0 Preview 3.0 [34728.248.main]
.NET SDK 8.0.300-preview.24170.4 (from the VS installation)
I'm sometimes hitting a null ref when running an integration test using
DistributedApplicationTestingBuilder
. Output from is below:Repro details
Visual Studio 2022 Int Preview 17.10.0 Preview 3.0 [34728.248.main]
.NET SDK 8.0.300-preview.24170.4 (from the VS installation)
Aspire workload 8.0.0-preview.5.24178.10/8.0.100 installed using installLatestFromReleaseBranch.ps1
Checkout
preview.5
branch of dotnet/aspire-samplesIn a terminal at the root of the repo, run
dotnet build .\build\Build.proj
Open
tests/SamplesTests/SamplesTests.sln
in Visual Studio and build the solutionIn the Test Explorer window, right-mouse click on the AppHostRunsCleanly test and select Run
This will run the test for all ten sample AppHost projects in the repo.
Click through the tests to see the test output log in the right-hand side of the Test Explorer window
Some of test results will show the null reference exception