Skip to content

Fix EnableDisableTests flakiness by removing shared static state#2484

Draft
Copilot wants to merge 3 commits intomainfrom
copilot/fix-enable-disable-tests-flakiness
Draft

Fix EnableDisableTests flakiness by removing shared static state#2484
Copilot wants to merge 3 commits intomainfrom
copilot/fix-enable-disable-tests-flakiness

Conversation

Copy link
Contributor

Copilot AI commented Mar 12, 2026

EnableDisableTests used static readonly fields for GpioDriverMock and GpioController, shared across all test instances. Parallel test execution caused one test to close/reset pin 1 on the shared mock while another test's device was mid-Enable(), throwing InvalidOperationException: Pin 1 is not yet opened.

  • Mcp23xxxTest.cs: Added nullable ResetDriverMock property and constructor overload to TestDevice struct (backward-compatible with existing tests)
  • EnableDisableTests.cs: Removed static s_driverMock/s_gpioMock fields. Each test device in ResetTestDevices now creates its own isolated GpioDriverMock. InitialResetState creates a local GpioController from the per-device mock.
// Before: single static mock shared across all tests
private static readonly GpioDriverMock s_driverMock = new GpioDriverMock();
devices.Add(new TestDevice(new Mcp23008(i2c, reset: 1, controller: new GpioController(s_driverMock)), i2c.DeviceMock));

// After: each test device gets its own mock
driverMock = new GpioDriverMock();
devices.Add(new TestDevice(new Mcp23008(i2c, reset: 1, controller: new GpioController(driverMock)), i2c.DeviceMock, driverMock));

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • 1oavsblobprodcus350.vsblob.vsassets.io
    • Triggering command: /tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/.dotnet/dotnet /tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/.dotnet/dotnet restore --no-dependencies /home/REDACTED/work/iot/iot/tools/ArduinoCsCompiler/ArduinoCsCompiler.sln --packages /tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/packages /p:DisableImplicitNuGetFallbackFolder=true --verbosity normal /p:TargetFrameworkRootPath=/tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/emptyFakeDotnetRoot /p:NetCoreTargetingPackRoot=/tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/emptyFakeDotnetRoot /p:AllowMissingPrunePackageData=true (dns block)
    • Triggering command: /tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/.dotnet/dotnet /tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/.dotnet/dotnet restore --no-dependencies /home/REDACTED/work/iot/iot/src/devices/Arduino/Arduino.sln --packages /tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/packages /p:DisableImplicitNuGetFallbackFolder=true --verbosity normal /p:TargetFrameworkRootPath=/tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/emptyFakeDotnetRoot /p:NetCoreTargetingPackRoot=/tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/emptyFakeDotnetRoot /p:AllowMissingPrunePackageData=true (dns block)
  • 1s1vsblobprodcus386.vsblob.vsassets.io
    • Triggering command: /tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/.dotnet/dotnet /tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/.dotnet/dotnet restore --no-dependencies /home/REDACTED/work/iot/iot/src/System.Device.Gpio/System.Device.Gpio.sln --packages /tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/packages /p:DisableImplicitNuGetFallbackFolder=true --verbosity normal /p:TargetFrameworkRootPath=/tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/emptyFakeDotnetRoot /p:NetCoreTargetingPackRoot=/tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/emptyFakeDotnetRoot /p:AllowMissingPrunePackageData=true (dns block)
    • Triggering command: /tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/.dotnet/dotnet /tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/.dotnet/dotnet restore --no-dependencies /home/REDACTED/work/iot/iot/tools/ArduinoCsCompiler/ArduinoCsCompiler.sln --packages /tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/packages /p:DisableImplicitNuGetFallbackFolder=true --verbosity normal /p:TargetFrameworkRootPath=/tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/emptyFakeDotnetRoot /p:NetCoreTargetingPackRoot=/tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/emptyFakeDotnetRoot /p:AllowMissingPrunePackageData=true (dns block)
    • Triggering command: /tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/.dotnet/dotnet /tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/.dotnet/dotnet restore --no-dependencies /home/REDACTED/work/iot/iot/tools/DevicesApiTester/DeviceApiTester.sln --packages /tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/packages /p:DisableImplicitNuGetFallbackFolder=true --verbosity normal /p:TargetFrameworkRootPath=/tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/emptyFakeDotnetRoot /p:NetCoreTargetingPackRoot=/tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/emptyFakeDotnetRoot /p:AllowMissingPrunePackageData=true (dns block)
  • 2kmvsblobprodcus39.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet dotnet build (dns block)
    • Triggering command: /usr/bin/dotnet dotnet build /p:SkipArcadeSdkImport=true (dns block)
    • Triggering command: /usr/bin/dotnet dotnet build /p:TreatWarningsAsErrors=false --nologo (dns block)
  • 37bvsblobprodcus311.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet dotnet build Mcp23xxx.csproj (dns block)
  • 37cvsblobprodcus359.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet dotnet build (dns block)
    • Triggering command: /usr/bin/dotnet dotnet build Mcp23xxx.csproj (dns block)
  • 4m6vsblobprodcus384.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet dotnet build (dns block)
  • 4vyvsblobprodcus361.vsblob.vsassets.io
    • Triggering command: /tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/.dotnet/dotnet /tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/.dotnet/dotnet restore --no-dependencies /home/REDACTED/work/iot/iot/samples/samples.sln --packages /tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/packages /p:DisableImplicitNuGetFallbackFolder=true --verbosity normal /p:TargetFrameworkRootPath=/tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/emptyFakeDotnetRoot /p:NetCoreTargetingPackRoot=/tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/emptyFakeDotnetRoot /p:AllowMissingPrunePackageData=true (dns block)
    • Triggering command: /tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/.dotnet/dotnet /tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/.dotnet/dotnet restore --no-dependencies /home/REDACTED/work/iot/iot/src/System.Device.Gpio/System.Device.Gpio.sln --packages /tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/packages /p:DisableImplicitNuGetFallbackFolder=true --verbosity normal /p:TargetFrameworkRootPath=/tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/emptyFakeDotnetRoot /p:NetCoreTargetingPackRoot=/tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/emptyFakeDotnetRoot /p:AllowMissingPrunePackageData=true (dns block)
    • Triggering command: /tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/.dotnet/dotnet /tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/.dotnet/dotnet restore --no-dependencies /home/REDACTED/work/iot/iot/tools/ArduinoCsCompiler/ArduinoCsCompiler.sln --packages /tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/packages /p:DisableImplicitNuGetFallbackFolder=true --verbosity normal /p:TargetFrameworkRootPath=/tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/emptyFakeDotnetRoot /p:NetCoreTargetingPackRoot=/tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/emptyFakeDotnetRoot /p:AllowMissingPrunePackageData=true (dns block)
  • 6s7vsblobprodcus313.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet dotnet build (dns block)
  • 80zvsblobprodcus35.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet dotnet build (dns block)
    • Triggering command: /tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/.dotnet/dotnet /tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/.dotnet/dotnet restore --no-dependencies /home/REDACTED/work/iot/iot/samples/samples.sln --packages /tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/packages /p:DisableImplicitNuGetFallbackFolder=true --verbosity normal /p:TargetFrameworkRootPath=/tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/emptyFakeDotnetRoot /p:NetCoreTargetingPackRoot=/tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/emptyFakeDotnetRoot /p:AllowMissingPrunePackageData=true (dns block)
    • Triggering command: /tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/.dotnet/dotnet /tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/.dotnet/dotnet restore --no-dependencies /home/REDACTED/work/iot/iot/src/System.Device.Gpio/System.Device.Gpio.sln --packages /tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/packages /p:DisableImplicitNuGetFallbackFolder=true --verbosity normal /p:TargetFrameworkRootPath=/tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/emptyFakeDotnetRoot /p:NetCoreTargetingPackRoot=/tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/emptyFakeDotnetRoot /p:AllowMissingPrunePackageData=true (dns block)
  • bcnvsblobprodcus378.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet dotnet build Mcp23xxx.csproj (dns block)
  • fdpvsblobprodcus345.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet dotnet build (dns block)
    • Triggering command: /usr/bin/dotnet dotnet build Mcp23xxx.csproj (dns block)
    • Triggering command: /tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/.dotnet/dotnet /tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/.dotnet/dotnet restore --no-dependencies /home/REDACTED/work/iot/iot/tools/ArduinoCsCompiler/ArduinoCsCompiler.sln --packages /tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/packages /p:DisableImplicitNuGetFallbackFolder=true --verbosity normal /p:TargetFrameworkRootPath=/tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/emptyFakeDotnetRoot /p:NetCoreTargetingPackRoot=/tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/emptyFakeDotnetRoot /p:AllowMissingPrunePackageData=true (dns block)
  • gbsvsblobprodcus365.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet dotnet build (dns block)
    • Triggering command: /tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/.dotnet/dotnet /tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/.dotnet/dotnet restore --no-dependencies /home/REDACTED/work/iot/iot/tools/ArduinoCsCompiler/ArduinoCsCompiler.sln --packages /tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/packages /p:DisableImplicitNuGetFallbackFolder=true --verbosity normal /p:TargetFrameworkRootPath=/tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/emptyFakeDotnetRoot /p:NetCoreTargetingPackRoot=/tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/emptyFakeDotnetRoot /p:AllowMissingPrunePackageData=true (dns block)
    • Triggering command: /tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/.dotnet/dotnet /tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/.dotnet/dotnet restore --no-dependencies /home/REDACTED/work/iot/iot/src/devices/Ft4222/Ft4222.sln --packages /tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/packages /p:DisableImplicitNuGetFallbackFolder=true --verbosity normal /p:TargetFrameworkRootPath=/tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/emptyFakeDotnetRoot /p:NetCoreTargetingPackRoot=/tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/emptyFakeDotnetRoot /p:AllowMissingPrunePackageData=true (dns block)
  • gervsblobprodcus329.vsblob.vsassets.io
    • Triggering command: /tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/.dotnet/dotnet /tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/.dotnet/dotnet restore --no-dependencies /home/REDACTED/work/iot/iot/tools/ArduinoCsCompiler/ArduinoCsCompiler.sln --packages /tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/packages /p:DisableImplicitNuGetFallbackFolder=true --verbosity normal /p:TargetFrameworkRootPath=/tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/emptyFakeDotnetRoot /p:NetCoreTargetingPackRoot=/tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/emptyFakeDotnetRoot /p:AllowMissingPrunePackageData=true (dns block)
    • Triggering command: /tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/.dotnet/dotnet /tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/.dotnet/dotnet restore --no-dependencies /home/REDACTED/work/iot/iot/tools/DevicesApiTester/DeviceApiTester.sln --packages /tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/packages /p:DisableImplicitNuGetFallbackFolder=true --verbosity normal /p:TargetFrameworkRootPath=/tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/emptyFakeDotnetRoot /p:NetCoreTargetingPackRoot=/tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/emptyFakeDotnetRoot /p:AllowMissingPrunePackageData=true (dns block)
  • ibzvsblobprodcus369.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet dotnet build (dns block)
    • Triggering command: /tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/.dotnet/dotnet /tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/.dotnet/dotnet restore --no-dependencies /home/REDACTED/work/iot/iot/samples/samples.sln --packages /tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/packages /p:DisableImplicitNuGetFallbackFolder=true --verbosity normal /p:TargetFrameworkRootPath=/tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/emptyFakeDotnetRoot /p:NetCoreTargetingPackRoot=/tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/emptyFakeDotnetRoot /p:AllowMissingPrunePackageData=true (dns block)
    • Triggering command: /tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/.dotnet/dotnet /tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/.dotnet/dotnet restore --no-dependencies /home/REDACTED/work/iot/iot/tools/ArduinoCsCompiler/ArduinoCsCompiler.sln --packages /tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/packages /p:DisableImplicitNuGetFallbackFolder=true --verbosity normal /p:TargetFrameworkRootPath=/tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/emptyFakeDotnetRoot /p:NetCoreTargetingPackRoot=/tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/emptyFakeDotnetRoot /p:AllowMissingPrunePackageData=true (dns block)
  • josvsblobprodcus372.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet dotnet build (dns block)
  • l49vsblobprodcus358.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet dotnet build (dns block)
  • o3svsblobprodcus318.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet dotnet build (dns block)
    • Triggering command: /usr/bin/dotnet dotnet build Mcp23xxx.csproj (dns block)
    • Triggering command: /tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/.dotnet/dotnet /tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/.dotnet/dotnet restore --no-dependencies /home/REDACTED/work/iot/iot/samples/samples.sln --packages /tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/packages /p:DisableImplicitNuGetFallbackFolder=true --verbosity normal /p:TargetFrameworkRootPath=/tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/emptyFakeDotnetRoot /p:NetCoreTargetingPackRoot=/tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/emptyFakeDotnetRoot /p:AllowMissingPrunePackageData=true (dns block)
  • ofvvsblobprodcus315.vsblob.vsassets.io
    • Triggering command: /tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/.dotnet/dotnet /tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/.dotnet/dotnet restore --no-dependencies /home/REDACTED/work/iot/iot/src/System.Device.Gpio/System.Device.Gpio.sln --packages /tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/packages /p:DisableImplicitNuGetFallbackFolder=true --verbosity normal /p:TargetFrameworkRootPath=/tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/emptyFakeDotnetRoot /p:NetCoreTargetingPackRoot=/tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/emptyFakeDotnetRoot /p:AllowMissingPrunePackageData=true (dns block)
    • Triggering command: /tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/.dotnet/dotnet /tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/.dotnet/dotnet restore --no-dependencies /home/REDACTED/work/iot/iot/tools/ArduinoCsCompiler/ArduinoCsCompiler.sln --packages /tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/packages /p:DisableImplicitNuGetFallbackFolder=true --verbosity normal /p:TargetFrameworkRootPath=/tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/emptyFakeDotnetRoot /p:NetCoreTargetingPackRoot=/tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/emptyFakeDotnetRoot /p:AllowMissingPrunePackageData=true (dns block)
    • Triggering command: /tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/.dotnet/dotnet /tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/.dotnet/dotnet restore --no-dependencies /home/REDACTED/work/iot/iot/tools/DevicesApiTester/DeviceApiTester.sln --packages /tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/packages /p:DisableImplicitNuGetFallbackFolder=true --verbosity normal /p:TargetFrameworkRootPath=/tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/emptyFakeDotnetRoot /p:NetCoreTargetingPackRoot=/tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/emptyFakeDotnetRoot /p:AllowMissingPrunePackageData=true (dns block)
  • p2ovsblobprodcus312.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet dotnet build (dns block)
    • Triggering command: /usr/bin/dotnet dotnet restore (dns block)
    • Triggering command: /usr/bin/dotnet dotnet build Mcp23xxx.csproj (dns block)
  • pkvvsblobprodcus321.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet dotnet build (dns block)
    • Triggering command: /tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/.dotnet/dotnet /tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/.dotnet/dotnet restore --no-dependencies /home/REDACTED/work/iot/iot/samples/samples.sln --packages /tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/packages /p:DisableImplicitNuGetFallbackFolder=true --verbosity normal /p:TargetFrameworkRootPath=/tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/emptyFakeDotnetRoot /p:NetCoreTargetingPackRoot=/tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/emptyFakeDotnetRoot /p:AllowMissingPrunePackageData=true (dns block)
    • Triggering command: /tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/.dotnet/dotnet /tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/.dotnet/dotnet restore --no-dependencies /home/REDACTED/work/iot/iot/src/System.Device.Gpio/System.Device.Gpio.sln --packages /tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/packages /p:DisableImplicitNuGetFallbackFolder=true --verbosity normal /p:TargetFrameworkRootPath=/tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/emptyFakeDotnetRoot /p:NetCoreTargetingPackRoot=/tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/emptyFakeDotnetRoot /p:AllowMissingPrunePackageData=true (dns block)
  • s4uvsblobprodcus326.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet dotnet build (dns block)
    • Triggering command: /usr/bin/dotnet dotnet build Mcp23xxx.csproj (dns block)
    • Triggering command: /tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/.dotnet/dotnet /tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/.dotnet/dotnet restore --no-dependencies /home/REDACTED/work/iot/iot/samples/samples.sln --packages /tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/packages /p:DisableImplicitNuGetFallbackFolder=true --verbosity normal /p:TargetFrameworkRootPath=/tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/emptyFakeDotnetRoot /p:NetCoreTargetingPackRoot=/tmp/codeql-scratch-db3f4ba25dde505c/dbs/csharp/working/emptyFakeDotnetRoot /p:AllowMissingPrunePackageData=true (dns block)
  • sc4vsblobprodcus331.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet dotnet build (dns block)
  • securitytools.pkgs.visualstudio.com
    • Triggering command: /opt/hostedtoolcache/CodeQL/2.24.2/x64/codeql/csharp/tools/linux64/Semmle.Autobuild.CSharp /opt/hostedtoolcache/CodeQL/2.24.2/x64/codeql/csharp/tools/linux64/Semmle.Autobuild.CSharp (dns block)
  • tphvsblobprodcus375.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet dotnet build (dns block)
    • Triggering command: /usr/bin/dotnet dotnet build Mcp23xxx.csproj (dns block)
  • ukkvsblobprodcus352.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet dotnet build (dns block)
    • Triggering command: /usr/bin/dotnet dotnet build Mcp23xxx.csproj (dns block)
  • uy6vsblobprodcus34.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet dotnet build Mcp23xxx.csproj (dns block)
  • yluvsblobprodcus367.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet dotnet build (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>EnableDisableTests flakiness</issue_title>
<issue_description>```
[xUnit.net 00:00:01.05] Iot.Device.Mcp23xxx.Tests.EnableDisableTests.InitialResetState(testDevice: Iot.Device.Mcp23xxx.Tests.Mcp23xxxTest+TestDevice) [FAIL]
Failed Iot.Device.Mcp23xxx.Tests.EnableDisableTests.InitialResetState(testDevice: Iot.Device.Mcp23xxx.Tests.Mcp23xxxTest+TestDevice) [1 ms]
Error Message:
System.InvalidOperationException : Pin 1 is not yet opened.
Stack Trace:
at Iot.Device.Mcp23xxx.Tests.Mcp23xxxTest.GpioDriverMock.GetPinMode(Int32 pinNumber) in /Users/runner/work/1/s/src/devices/Mcp23xxx/tests/Mcp23xxxTest.cs:line 243
at System.Device.Gpio.GpioController.Write(Int32 pinNumber, PinValue value) in /_/src/System.Device.Gpio/System/Device/Gpio/GpioController.cs:line 277
at Iot.Device.Mcp23xxx.Mcp23xxx.Enable() in /Users/runner/work/1/s/src/devices/Mcp23xxx/Mcp23xxx.cs:line 294
at Iot.Device.Mcp23xxx.Tests.EnableDisableTests.InitialResetState(TestDevice testDevice) in /Users/runner/work/1/s/src/devices/Mcp23xxx/tests/EnableDisableTests.cs:line 23
at InvokeStub_EnableDisableTests.InitialResetState(Object, Span`1)
at System.Reflection.MethodBaseInvoker.InvokeWithOneArg(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)


<agent_instructions>This looks like parallelization issue and likely we should just remove static pieces and replace them with instance. Ideally make minimal changes to the branch</agent_instructions>

## Comments on the Issue (you are @copilot in this section)

<comments>
</comments>


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Microsoft Reviewers: Open in CodeFlow

…h per-device instances

Co-authored-by: krwq <660048+krwq@users.noreply.github.com>
@dotnet-policy-service dotnet-policy-service bot added the area-device-bindings Device Bindings for audio, sensor, motor, and display hardware that can used with System.Device.Gpio label Mar 12, 2026
Co-authored-by: krwq <660048+krwq@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix flakiness in EnableDisableTests for initial reset state Fix EnableDisableTests flakiness by removing shared static state Mar 12, 2026
Copilot AI requested a review from krwq March 12, 2026 17:01
Copilot finished work on behalf of krwq March 12, 2026 17:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-device-bindings Device Bindings for audio, sensor, motor, and display hardware that can used with System.Device.Gpio

Projects

None yet

Development

Successfully merging this pull request may close these issues.

EnableDisableTests flakiness

2 participants