From e6e98f37c354aa0b0aeef1da39fa97ae1eb3a12b Mon Sep 17 00:00:00 2001 From: Yousaf Nabi Date: Fri, 13 Nov 2026 17:37:05 +0000 Subject: [PATCH 1/5] feat(ffi): upgrade to libpact_ffi 0.5.13 Updates the underlying Rust core from libpact_ffi 0.4.27 to 0.5.13, which moves the mock server to pact_mock_server v2 and brings a suite of improvements and bug fixes, including repeated custom headers continuing to match (pact-foundation/pact-reference#602). - Download pact_ffi from the cargo-dist `pact_ffi-v` release: per-target .tar.xz/.zip archives, sha256 verified, with the shared library extracted to the same build/// paths. - Refresh pact metadata to ffi 0.5.13 / models 1.3.18. --- CONTRIBUTING.md | 10 +-- build/download-native-libs.sh | 71 +++++++++++-------- .../pacts/Fulfilment API-Orders API.json | 4 +- .../data/v2-consumer-integration.json | 4 +- .../data/v3-consumer-integration.json | 4 +- .../data/v3-message-consumer-integration.json | 4 +- .../data/v3-message-integration.json | 4 +- .../data/v3-server-integration.json | 4 +- .../data/v4-combined-integration.json | 4 +- .../data/v4-consumer-integration.json | 4 +- .../data/v4-message-consumer-integration.json | 4 +- 11 files changed, 67 insertions(+), 50 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a8aa3f7a..689458a2 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -53,14 +53,16 @@ Building PactNet ---------------- In order to build PactNet you must first download the native Rust FFI libraries. You can pull the current supported -version by executing the script in Bash (or Git Bash on Windows): +version by executing the script in Bash (or Git Bash on Windows). The script needs `curl`, `tar` with xz support, and +`unzip` (or `7z`) on the path, and verifies each archive against its `.sha256` file: ```bash build/download-native-libs.sh ``` -Alternatively you can download a particular FFI version from the [pact-reference] releases or build your own version -locally, and then copy the artifacts into the folders: +Alternatively you can download a particular FFI version from the [pact-reference] `pact_ffi-v` releases (one +archive per Rust target, e.g. `pact_ffi-aarch64-apple-darwin.tar.xz`) or build your own version locally, and then copy +the shared libraries into the folders: ``` build/ @@ -69,7 +71,7 @@ build/ libpact_ffi.so aarch64/ libpact_ffi.so - osx/ + macos/ aarch64/ libpact_ffi.dylib x86_64/ diff --git a/build/download-native-libs.sh b/build/download-native-libs.sh index c3ace891..46d492cd 100755 --- a/build/download-native-libs.sh +++ b/build/download-native-libs.sh @@ -1,8 +1,8 @@ #!/usr/bin/env bash set -euo pipefail -FFI_VERSION="0.4.27" -FFI_BASE_URL="https://github.com/pact-foundation/pact-reference/releases/download/libpact_ffi-v$FFI_VERSION" +FFI_VERSION="0.5.13" +FFI_BASE_URL="https://github.com/pact-foundation/pact-reference/releases/download/pact_ffi-v$FFI_VERSION" GREEN="\e[32m" YELLOW="\e[33m" @@ -12,60 +12,75 @@ CLEAR="\e[0m" base_path=$(dirname "$0") download_native() { - file="$1" - os="$2" - platform="$3" - extension="$4" + os="$1" + platform="$2" + target="$3" + archive_ext="$4" + lib="$5" # e.g. - # pact_ffi-windows-x86_64.dll.gz - # libpact_ffi-linux-x86_64.so.gz - # libpact_ffi-macos-x86_64.dylib.gz - src_file="$file-$os-$platform.$extension" - src_archive="$src_file.gz" + # pact_ffi-x86_64-pc-windows-msvc.zip (pact_ffi.dll at the archive root) + # pact_ffi-x86_64-unknown-linux-gnu.tar.xz (pact_ffi-/libpact_ffi.so) + # pact_ffi-aarch64-apple-darwin.tar.xz (pact_ffi-/libpact_ffi.dylib) + src_archive="pact_ffi-$target.$archive_ext" src_sha="$src_archive.sha256" - dest_file="$file.$extension" url="$FFI_BASE_URL/$src_archive" sha="$url.sha256" path="$base_path/$os/$platform" mkdir -p "$path" - pushd $path > /dev/null + pushd "$path" > /dev/null echo -e "Downloading FFI library for ${YELLOW}$os/$platform${CLEAR}" - echo -e " Destination: ${BLUE}$path/$src_archive${CLEAR}" + echo -e " Destination: ${BLUE}$path/$lib${CLEAR}" echo -e " URL: ${BLUE}$url${CLEAR}" echo -n " Downloading... " - curl --silent -L "$url" -o "$src_archive" - curl --silent -L "$sha" -o "$src_archive.sha256" + curl --silent --show-error --fail -L "$url" -o "$src_archive" + curl --silent --show-error --fail -L "$sha" -o "$src_sha" echo -e "${GREEN}OK${CLEAR}" echo -n " Verifying... " if [[ "$OSTYPE" == "darwin"* ]]; then - shasum -a 256 --check --quiet "$src_sha" + sed '/^$/d' "$src_sha" | shasum -a 256 --check --quiet - else - sha256sum --check --quiet "$src_sha" + sed '/^$/d' "$src_sha" | sha256sum --check --quiet - fi echo -e "${GREEN}OK${CLEAR}" echo -n " Extracting... " - gunzip -f "$src_archive" + extract_dir=$(mktemp -d) + if [[ "$archive_ext" == "zip" ]]; then + extract_zip "$src_archive" "$extract_dir" + extracted="$extract_dir/$lib" + else + tar -xJf "$src_archive" -C "$extract_dir" + extracted="$extract_dir/pact_ffi-$target/$lib" + fi + mv -f "$extracted" "$lib" + rm -rf "$extract_dir" "$src_archive" "$src_sha" echo -e "${GREEN}OK${CLEAR}" echo "" - mv "$src_file" "$dest_file" - rm "$src_sha" - popd > /dev/null } -download_native "pact_ffi" "windows" "x86_64" "dll" -download_native "libpact_ffi" "linux" "x86_64" "so" -download_native "libpact_ffi" "linux" "aarch64" "so" -download_native "libpact_ffi" "macos" "x86_64" "dylib" -download_native "libpact_ffi" "macos" "aarch64" "dylib" +extract_zip() { + if command -v unzip > /dev/null; then + unzip -q -o "$1" -d "$2" + elif command -v 7z > /dev/null; then + 7z x -y -o"$2" "$1" > /dev/null + else + tar -xf "$1" -C "$2" + fi +} + +download_native "windows" "x86_64" "x86_64-pc-windows-msvc" "zip" "pact_ffi.dll" +download_native "linux" "x86_64" "x86_64-unknown-linux-gnu" "tar.xz" "libpact_ffi.so" +download_native "linux" "aarch64" "aarch64-unknown-linux-gnu" "tar.xz" "libpact_ffi.so" +download_native "macos" "x86_64" "x86_64-apple-darwin" "tar.xz" "libpact_ffi.dylib" +download_native "macos" "aarch64" "aarch64-apple-darwin" "tar.xz" "libpact_ffi.dylib" -echo "Successfully downloaded FFI libraries" \ No newline at end of file +echo "Successfully downloaded FFI libraries" diff --git a/samples/OrdersApi/Consumer.Tests/pacts/Fulfilment API-Orders API.json b/samples/OrdersApi/Consumer.Tests/pacts/Fulfilment API-Orders API.json index b6f1a702..70cb05f7 100644 --- a/samples/OrdersApi/Consumer.Tests/pacts/Fulfilment API-Orders API.json +++ b/samples/OrdersApi/Consumer.Tests/pacts/Fulfilment API-Orders API.json @@ -158,8 +158,8 @@ ], "metadata": { "pactRust": { - "ffi": "0.4.27", - "models": "1.2.8" + "ffi": "0.5.13", + "models": "1.3.18" }, "pactSpecification": { "version": "4.0" diff --git a/tests/PactNet.Tests/data/v2-consumer-integration.json b/tests/PactNet.Tests/data/v2-consumer-integration.json index 9484eef4..83b46b98 100644 --- a/tests/PactNet.Tests/data/v2-consumer-integration.json +++ b/tests/PactNet.Tests/data/v2-consumer-integration.json @@ -74,8 +74,8 @@ ], "metadata": { "pactRust": { - "ffi": "0.4.27", - "models": "1.2.8" + "ffi": "0.5.13", + "models": "1.3.18" }, "pactSpecification": { "version": "2.0.0" diff --git a/tests/PactNet.Tests/data/v3-consumer-integration.json b/tests/PactNet.Tests/data/v3-consumer-integration.json index b220eb49..7244aa1b 100644 --- a/tests/PactNet.Tests/data/v3-consumer-integration.json +++ b/tests/PactNet.Tests/data/v3-consumer-integration.json @@ -130,8 +130,8 @@ ], "metadata": { "pactRust": { - "ffi": "0.4.27", - "models": "1.2.8" + "ffi": "0.5.13", + "models": "1.3.18" }, "pactSpecification": { "version": "3.0.0" diff --git a/tests/PactNet.Tests/data/v3-message-consumer-integration.json b/tests/PactNet.Tests/data/v3-message-consumer-integration.json index 494ea225..5e44b239 100644 --- a/tests/PactNet.Tests/data/v3-message-consumer-integration.json +++ b/tests/PactNet.Tests/data/v3-message-consumer-integration.json @@ -36,8 +36,8 @@ "language": "C#" }, "pactRust": { - "ffi": "0.4.27", - "models": "1.2.8" + "ffi": "0.5.13", + "models": "1.3.18" }, "pactSpecification": { "version": "3.0.0" diff --git a/tests/PactNet.Tests/data/v3-message-integration.json b/tests/PactNet.Tests/data/v3-message-integration.json index 4a3ace22..07786942 100644 --- a/tests/PactNet.Tests/data/v3-message-integration.json +++ b/tests/PactNet.Tests/data/v3-message-integration.json @@ -16,8 +16,8 @@ ], "metadata": { "pactRust": { - "ffi": "0.4.27", - "models": "1.2.8" + "ffi": "0.5.13", + "models": "1.3.18" }, "pactSpecification": { "version": "3.0.0" diff --git a/tests/PactNet.Tests/data/v3-server-integration.json b/tests/PactNet.Tests/data/v3-server-integration.json index c5050bd5..10db5b91 100644 --- a/tests/PactNet.Tests/data/v3-server-integration.json +++ b/tests/PactNet.Tests/data/v3-server-integration.json @@ -46,8 +46,8 @@ ], "metadata": { "pactRust": { - "ffi": "0.4.27", - "models": "1.2.8" + "ffi": "0.5.13", + "models": "1.3.18" }, "pactSpecification": { "version": "3.0.0" diff --git a/tests/PactNet.Tests/data/v4-combined-integration.json b/tests/PactNet.Tests/data/v4-combined-integration.json index 61808511..4739dcf1 100644 --- a/tests/PactNet.Tests/data/v4-combined-integration.json +++ b/tests/PactNet.Tests/data/v4-combined-integration.json @@ -185,8 +185,8 @@ "language": "C#" }, "pactRust": { - "ffi": "0.4.27", - "models": "1.2.8" + "ffi": "0.5.13", + "models": "1.3.18" }, "pactSpecification": { "version": "4.0" diff --git a/tests/PactNet.Tests/data/v4-consumer-integration.json b/tests/PactNet.Tests/data/v4-consumer-integration.json index 87ef562b..409bc40c 100644 --- a/tests/PactNet.Tests/data/v4-consumer-integration.json +++ b/tests/PactNet.Tests/data/v4-consumer-integration.json @@ -150,8 +150,8 @@ ], "metadata": { "pactRust": { - "ffi": "0.4.27", - "models": "1.2.8" + "ffi": "0.5.13", + "models": "1.3.18" }, "pactSpecification": { "version": "4.0" diff --git a/tests/PactNet.Tests/data/v4-message-consumer-integration.json b/tests/PactNet.Tests/data/v4-message-consumer-integration.json index 8861180b..ddd378f1 100644 --- a/tests/PactNet.Tests/data/v4-message-consumer-integration.json +++ b/tests/PactNet.Tests/data/v4-message-consumer-integration.json @@ -41,8 +41,8 @@ "language": "C#" }, "pactRust": { - "ffi": "0.4.27", - "models": "1.2.8" + "ffi": "0.5.13", + "models": "1.3.18" }, "pactSpecification": { "version": "4.0" From 7b66e62697fd0e7fb9859e524038c21ca1a2c47f Mon Sep 17 00:00:00 2001 From: Yousaf Nabi Date: Fri, 13 Nov 2026 17:47:58 +0000 Subject: [PATCH 2/5] fix(ci): disable hot reload browser tools in Provider.Tests for .NET SDK 11 The ubuntu-24.04-arm runner image now ships .NET SDK 11.0.100, which is picked over the setup-dotnet 8.0.x install. SDK 11 generates hot reload browser-tools static web assets for Web SDK projects in Debug, and the build then fails with "scoped css bundles do not have matching endpoints". --- samples/OrdersApi/Provider.Tests/Provider.Tests.csproj | 3 +++ 1 file changed, 3 insertions(+) diff --git a/samples/OrdersApi/Provider.Tests/Provider.Tests.csproj b/samples/OrdersApi/Provider.Tests/Provider.Tests.csproj index 1517e0f4..dbae7d98 100644 --- a/samples/OrdersApi/Provider.Tests/Provider.Tests.csproj +++ b/samples/OrdersApi/Provider.Tests/Provider.Tests.csproj @@ -2,6 +2,9 @@ net8.0 false + + false From f6be3127cc81a828c1b465c768afb4eec99a5e52 Mon Sep 17 00:00:00 2001 From: Yousaf Nabi Date: Wed, 18 Nov 2026 12:28:38 +0000 Subject: [PATCH 3/5] feat: support linux musl via portable-rid - use .NET SDK's own portable runtime identifier, which already distinguishes glibc (linux-x64/arm64) from musl (linux-musl-x64/arm64). - Simplify checksum verification in download-native-libs.sh to plain `sha256sum -c`, which works with both GNU coreutils and BusyBox, removing the ldd-based branch. --- .github/workflows/ci.yml | 46 ++++++++++++++++++++++++++++++++++- README.md | 20 +++++++-------- build/download-native-libs.sh | 6 ++++- src/PactNet/PactNet.csproj | 43 ++++++++++++++++++++++---------- 4 files changed, 90 insertions(+), 25 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ca135af5..e40c041b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -75,8 +75,52 @@ jobs: name: nupkgs path: ./dist/*.* + build-dotnet-containers: + runs-on: ubuntu-latest + name: ${{ matrix.os }}-${{ matrix.distro }}-build-dotnet-container + strategy: + fail-fast: false + matrix: + os: + - ubuntu-24.04 + - ubuntu-24.04-arm + distro: + - "mcr.microsoft.com/dotnet/sdk:8.0" + - "mcr.microsoft.com/dotnet/sdk:8.0-alpine3.22" + - "mcr.microsoft.com/dotnet/sdk:8.0-alpine3.23" + - "mcr.microsoft.com/dotnet/sdk:8.0-alpine3.24" + + steps: + - uses: actions/checkout@v4 + + - name: Docker dependencies + id: docker_commands + shell: bash + run: | + if [[ ${{ matrix.distro }} == *"alpine"* ]]; then + echo "deps=apk add --no-cache curl bash gzip && " >> "$GITHUB_OUTPUT" + else + echo "deps=" >> "$GITHUB_OUTPUT" + fi + + - name: Restore, Build & Test + run: | + docker run \ + --rm \ + -v $(pwd):/${{ github.workspace }} \ + -w ${{ github.workspace }} \ + --entrypoint /bin/sh \ + ${{ matrix.distro }} \ + -c '${{ steps.docker_commands.outputs.deps }} \ + build/download-native-libs.sh && \ + dotnet restore && dotnet build --no-restore && \ + dotnet test --no-build --verbosity normal' + release: - needs: build-dotnet + needs: [ + build-dotnet, + build-dotnet-containers + ] if: github.ref_type == 'tag' runs-on: ubuntu-latest steps: diff --git a/README.md b/README.md index c70c541b..0bfa3a55 100644 --- a/README.md +++ b/README.md @@ -232,16 +232,16 @@ For writing messaging pacts instead of requests/response pacts, see the [messagi Due to using a shared native library instead of C# for the main Pact logic only certain OSs are supported: -| OS | Arch | Support | -| ------------ | ------------ | -------------------------------------------------------------------| -| Windows | x86 | ❌ No | -| Windows | x64 | ✔️ Yes | -| Linux (libc) | ARM64 | ✔️ Yes | -| Linux (libc) | x64 | ✔️ Yes | -| Linux (libc) | x86 | ❌ No | -| Linux (musl) | Any | ❌ [No](https://github.com/pact-foundation/pact-net/issues/374) | -| OSX | x64 | ✔️ Yes | -| OSX | ARM64 (M1/M2)| ✔️ Yes | +| OS | Arch | Support | +| ------------ | ----------- | -------------------------------------------------------------------| +| Windows | x86 | ❌ No | +| Windows | x64 | ✔️ Yes | +| Linux (libc) | ARM | ✔️ Yes | +| Linux (libc) | x86 | ❌ No | +| Linux (libc) | x64 | ✔️ Yes | +| Linux (musl) | Any | ✔️ Yes | +| OSX | x64 | ✔️ Yes | +| OSX | ARM (M1/M2) | ✔️ Yes | ### Pact Specification diff --git a/build/download-native-libs.sh b/build/download-native-libs.sh index 46d492cd..2f24971f 100755 --- a/build/download-native-libs.sh +++ b/build/download-native-libs.sh @@ -45,7 +45,9 @@ download_native() { if [[ "$OSTYPE" == "darwin"* ]]; then sed '/^$/d' "$src_sha" | shasum -a 256 --check --quiet - else - sed '/^$/d' "$src_sha" | sha256sum --check --quiet - + # GNU coreutils and BusyBox (Alpine) both accept plain -c on a file + sed -i '/^$/d' "$src_sha" + sha256sum -c "$src_sha" > /dev/null fi echo -e "${GREEN}OK${CLEAR}" @@ -82,5 +84,7 @@ download_native "linux" "x86_64" "x86_64-unknown-linux-gnu" "tar.xz" "libpact_ff download_native "linux" "aarch64" "aarch64-unknown-linux-gnu" "tar.xz" "libpact_ffi.so" download_native "macos" "x86_64" "x86_64-apple-darwin" "tar.xz" "libpact_ffi.dylib" download_native "macos" "aarch64" "aarch64-apple-darwin" "tar.xz" "libpact_ffi.dylib" +download_native "linux" "x86_64-musl" "x86_64-unknown-linux-musl" "tar.xz" "libpact_ffi.so" +download_native "linux" "aarch64-musl" "aarch64-unknown-linux-musl" "tar.xz" "libpact_ffi.so" echo "Successfully downloaded FFI libraries" diff --git a/src/PactNet/PactNet.csproj b/src/PactNet/PactNet.csproj index 3cb10197..c0a77663 100644 --- a/src/PactNet/PactNet.csproj +++ b/src/PactNet/PactNet.csproj @@ -10,15 +10,18 @@ + - False - False - False - False - True - True - True - True + $(NETCoreSdkPortableRuntimeIdentifier) + $(NETCoreSdkRuntimeIdentifier) + $([System.Runtime.InteropServices.RuntimeInformation]::RuntimeIdentifier) @@ -26,35 +29,49 @@ pact_ffi.dll runtimes/win-x64/native true - PreserveNewest + PreserveNewest false libpact_ffi.so runtimes/linux-x64/native true - PreserveNewest + PreserveNewest false libpact_ffi.so runtimes/linux-arm64/native true - PreserveNewest + PreserveNewest + false + + + libpact_ffi.so + runtimes/linux-musl-x64/native + true + PreserveNewest + false + + + libpact_ffi.so + runtimes/linux-musl-arm64/native + true + PreserveNewest false libpact_ffi.dylib runtimes/osx-x64/native true - PreserveNewest + PreserveNewest false libpact_ffi.dylib runtimes/osx-arm64/native true - PreserveNewest + PreserveNewest false From ba7612b3de6e6d7f861c8da45c614a1c3e0af882 Mon Sep 17 00:00:00 2001 From: Yousaf Nabi Date: Wed, 18 Nov 2026 15:27:00 +0000 Subject: [PATCH 4/5] fix(ci): install unzip and xz-utils in Debian SDK container libpact_ffi 0.5.13 ships .zip and .tar.xz archives. The mcr.microsoft.com/dotnet/sdk:8.0 (Debian bookworm) image has neither unzip nor xz, so the GNU tar fallback failed on the Windows zip. Install both, and fail with a clear message instead of falling back to a tar that cannot read zip files. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/ci.yml | 2 +- build/download-native-libs.sh | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e40c041b..1f21fe3a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -100,7 +100,7 @@ jobs: if [[ ${{ matrix.distro }} == *"alpine"* ]]; then echo "deps=apk add --no-cache curl bash gzip && " >> "$GITHUB_OUTPUT" else - echo "deps=" >> "$GITHUB_OUTPUT" + echo "deps=apt-get update && apt-get install -y --no-install-recommends unzip xz-utils && " >> "$GITHUB_OUTPUT" fi - name: Restore, Build & Test diff --git a/build/download-native-libs.sh b/build/download-native-libs.sh index 2f24971f..d9e31ce4 100755 --- a/build/download-native-libs.sh +++ b/build/download-native-libs.sh @@ -74,8 +74,11 @@ extract_zip() { unzip -q -o "$1" -d "$2" elif command -v 7z > /dev/null; then 7z x -y -o"$2" "$1" > /dev/null - else + elif tar --version 2>/dev/null | grep -q bsdtar; then tar -xf "$1" -C "$2" + else + echo "error: unzip (or 7z/bsdtar) is required to extract $1" >&2 + exit 1 fi } From e1dd3c544421fa4eff60037bc9b609e01ce54f59 Mon Sep 17 00:00:00 2001 From: Yousaf Nabi Date: Wed, 18 Nov 2026 15:34:09 +0000 Subject: [PATCH 5/5] fix(messaging): retry on address-in-use under musl MessagingProvider only retried when the HttpListenerException message was exactly "Address already in use" (glibc wording). musl reports the same errno (98) as "Address in use", so on Alpine a port race failed instead of retrying. Match on the EADDRINUSE error code (Linux/macOS/Winsock), keeping the message as a fallback. Co-Authored-By: Claude Opus 5.5 --- .../Verifier/Messaging/MessagingProvider.cs | 25 +++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/src/PactNet/Verifier/Messaging/MessagingProvider.cs b/src/PactNet/Verifier/Messaging/MessagingProvider.cs index 5b70cef5..d531cf75 100644 --- a/src/PactNet/Verifier/Messaging/MessagingProvider.cs +++ b/src/PactNet/Verifier/Messaging/MessagingProvider.cs @@ -74,9 +74,9 @@ public Uri Start(JsonSerializerOptions settings) this.server.Prefixes.Add(uri.AbsoluteUri); this.server.Start(); } - catch (HttpListenerException e) when (e.Message == "Address already in use") + catch (HttpListenerException e) when (IsAddressInUse(e)) { - // handle intermittent race condition, mostly on MacOS, where a port says it's unused but still throws when you try to use it + // handle intermittent race condition, where a port says it's unused but still throws when you try to use it this.config.WriteLine("Failed to start messaging provider as the port is already in use, retrying..."); continue; } @@ -90,6 +90,27 @@ public Uri Start(JsonSerializerOptions settings) } } + /// + /// Check if the listener failed to start because the port is already bound + /// + /// + /// The error code is the platform errno for EADDRINUSE. The message text differs by libc + /// (glibc: "Address already in use", musl: "Address in use"), so it is only a fallback. + /// + /// Listener exception + /// Port was already in use + private static bool IsAddressInUse(HttpListenerException e) + { + const int LinuxAddressInUse = 98; + const int MacAddressInUse = 48; + const int WindowsSocketAddressInUse = 10048; + + return e.ErrorCode == LinuxAddressInUse + || e.ErrorCode == MacAddressInUse + || e.ErrorCode == WindowsSocketAddressInUse + || e.Message.IndexOf("in use", StringComparison.OrdinalIgnoreCase) >= 0; + } + /// /// Find an unused port on which to host the messaging server ///