mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-01-11 14:20:29 +01:00
Order of WireMockContainerBuilder WithX calls caused duplicate Networks in Configuration #650
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @epDugas on GitHub (Dec 11, 2024).
Originally assigned to: @StefH on GitHub.
Describe the bug
The order of the .WithX calls to WireMockContainerBuilder can cause duplicate Networks in Configuration.
Expected behavior:
Expected the order of WireMockContainerBuilder.WithX calls to not duplicate Networks in the Configuration.
Test to reproduce
WireMockContainerBuilder.WithNetwork(x);WireMockContainerBuilder.WithMappings(x)andWireMockContainerBuilder.WithWatchStaticMappings(true);Other related info
This was observed when updating WireMock.net. Some previous working code failed, an exception was thrown because of the duplicate Network entries in:
https://github.com/testcontainers/testcontainers-dotnet/blob/develop/src/Testcontainers/Clients/ContainerConfigurationConverter.cs at line 30.
Changing the order of the .WithX calls resolved the issue.

@StefH commented on GitHub (Dec 17, 2024):
@epDugas
Can you please provide a full working example (console app or unit test) which shows this issue?
@epDugas commented on GitHub (Dec 21, 2024):
See attached for console app demonstrating issue.
dotnet_console_test.zip
@StefH commented on GitHub (Dec 21, 2024):
Are you using Linux or Windows containers?
@StefH commented on GitHub (Dec 21, 2024):
@epDugas
Thanks for creating this issue. Some more entries where duplicated it seems.
It should be fixed now, can you use preview version 1.6.10-ci-19504
(https://github.com/WireMock-Net/WireMock.Net/wiki/MyGet-preview-versions)
@epDugas commented on GitHub (Dec 21, 2024):
Thanks @StefH !
Linux
@StefH commented on GitHub (Dec 22, 2024):
https://github.com/WireMock-Net/WireMock.Net/pull/1222
@StefH commented on GitHub (Dec 24, 2024):
@epDugas
If you have time, you can test version
1.6.10-ci-19519.@epDugas commented on GitHub (Dec 31, 2024):
Verified issue resolved. Thanks @StefH !