Null Ports property on ListContainersAsync
- Dominant language
- C#
- Stars
- 2.4k
- Forks
- 416
- PR merge metrics
- No merged PRs in 30d
Description
Hi, I found that some containers returned by `ListContainersAsync` may have a `null` `Ports` property instead of returning an empty `IList`.
### Code Example
```csharp
// DockerClient injected via DI
var dockerContainers = await _dockerClient.Containers.ListContainersAsync(
new ContainersListParameters { All = true }, cancellationToken);
foreach(var dockerContainer in dockerContainers)
{
// Ports property may be null
var ports = dockerContainer.Ports;
}
```
### Inspected Example
In this example you can see the informations related to a container that actuallly has `null` `Ports` property.
### System Info
**Result of `dotnet --info`:**
```
.NET SDK:
Version: 10.0.201
Commit: 4d3023de60
Workload version: 10.0.200-manifests.121cc9e6
MSBuild version: 18.3.0-release-26153-122+4d3023de6
Runtime Environment:
OS Name: Windows
OS Version: 10.0.26200
OS Platform: Windows
RID: win-x64
Base Path: C:\Program Files\dotnet\sdk\10.0.201\
.NET workloads installed:
There are no installed workloads to display.
Configured to use workload sets when installing new manifests.
No workload sets are installed. Run "dotnet workload restore" to install a workload set.
Host:
Version: 10.0.5
Architecture: x64
Commit: a612c2a105
.NET SDKs installed:
10.0.201 [C:\Program Files\dotnet\sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 10.0.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.36 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.22 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 10.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 6.0.36 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 10.0.5 [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:
DOTNET_CLI_UI_LANGUAGE [en-US]
DOTNET_GCHeapCount [2]
DOTNET_GCNoAffinitize [1]
DOTNET_MULTILEVEL_LOOKUP [0]
DOTNET_TC_CallCountThreshold [1000]
DOTNET_ThreadPool_UnfairSemaphoreSpinLimit [0]
DOTNET_gcConcurrent [0]
Detected COMPlus_* environment variable(s). Consider transitioning to DOTNET_* equivalent.
global.json file:
Not found
Learn more:
https://aka.ms/dotnet/info
Download .NET:
https://aka.ms/dotnet/download
```
**Docker.DotNet Version:**
```3.125.15```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.