Skip to content

fix(build): resolve CI failures after dependency updates - #611

Merged
AndreaCuneo merged 7 commits into
renovate/all-minor-patchfrom
copilot/sub-pr-601
Jan 22, 2026
Merged

fix(build): resolve CI failures after dependency updates#611
AndreaCuneo merged 7 commits into
renovate/all-minor-patchfrom
copilot/sub-pr-601

Conversation

Copilot AI commented Jan 22, 2026

Copy link
Copy Markdown
Contributor

CI tests fail after dependency updates due to two distinct issues that emerged with the updated packages.

Root Causes

Issue 1: Missing DACPAC File

The database project's CopyDacpac target used platform-conditional Exec commands (copy on Windows, cp on Linux) that depend on MSBuild properties $(IsWindows) and $(IsLinux). These properties failed to evaluate correctly in CI, preventing the dacpac from being copied to the test project.

Issue 2: SQL Server UDT Cache Error

After updating Microsoft.Data.SqlClient from 6.1.3 to 6.1.4, tests failed with "The definition for user-defined data type 'udt_State_v2' has changed". The newer version has stricter schema validation that requires SQL Server's plan cache to be explicitly cleared after DROP/CREATE TYPE operations.

Changes

  • Replaced shell commands with MSBuild Copy task in Ark.Reference.Core.Database.sqlproj

    • Uses cross-platform <Copy> task instead of conditional <Exec> commands
    • Removes dependency on platform detection properties
  • Removed unused MSBuild properties

    • Deleted IsWindows and IsLinux property definitions
  • Added plan cache clearing in SqlStateProvider

    • Executes DBCC FREEPROCCACHE after recreating user-defined table types in EnsureTableAreCreated()
    • Includes error handling for environments with restricted permissions (e.g., Azure SQL Database)
    • Resolves compatibility issues with Microsoft.Data.SqlClient 6.1.4's stricter schema validation

Database Project - Before:

<Target Name="CopyDacpac" AfterTargets="Build">
  <Exec Command="copy /y &quot;...&quot;" Condition="'$(IsWindows)' == 'true'" />
  <Exec Command="cp -f &quot;...&quot;" Condition="'$(IsLinux)' == 'true'" />
</Target>

Database Project - After:

<Target Name="CopyDacpac" AfterTargets="Build">
  <Copy SourceFiles="$(MSBuildThisFileDirectory)bin\$(Configuration)\$(Name).dacpac" 
        DestinationFolder="$(MSBuildThisFileDirectory)..\Ark.Reference.Core.Tests\" />
</Target>

SqlStateProvider - After:

c.Execute(typeQuery);

// Clear procedure cache after recreating UDTs
try
{
    c.Execute("DBCC FREEPROCCACHE");
}
catch (Exception)
{
    // Best-effort - gracefully handle permission restrictions
}

Testing

  • ✅ All Ark.Reference.Core.Tests pass (40 tests)
  • ✅ All Ark.Tools.ResourceWatcher.Tests pass (62 tests)
  • ✅ Verified with clean builds and --no-build scenarios

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits January 22, 2026 10:59
…commands

Replace platform-specific Exec commands (copy/cp) with cross-platform MSBuild Copy task in CopyDacpac target. This ensures the dacpac file is reliably copied to the test project directory on all platforms, fixing CI test failures.

The previous implementation used conditional Exec commands that depended on $(IsWindows) and $(IsLinux) properties, which may not evaluate correctly in all build environments.

Co-authored-by: AndreaCuneo <5227688+AndreaCuneo@users.noreply.github.com>
…timize Copy task

- Remove IsWindows and IsLinux property definitions that are no longer used
- Remove explicit SkipUnchangedFiles="false" to use the default true value for better build performance

Co-authored-by: AndreaCuneo <5227688+AndreaCuneo@users.noreply.github.com>

Copilot AI commented Jan 22, 2026

Copy link
Copy Markdown
Contributor Author

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

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:

  • dc.applicationinsights.azure.com
    • Triggering command: /home/REDACTED/work/Ark.Tools/Ark.Tools/samples/Ark.ReferenceProject/Core/Ark.Reference.Core.Tests/bin/Debug/net10.0/Ark.Reference.Core.Tests /home/REDACTED/work/Ark.Tools/Ark.Tools/samples/Ark.ReferenceProject/Core/Ark.Reference.Core.Tests/bin/Debug/net10.0/Ark.Reference.Core.Tests --server dotnettestcli --dotnet-test-pipe /tmp/4a2ac7f167804f76a58fcde32ecc51b5 (dns block)
    • Triggering command: /home/REDACTED/work/Ark.Tools/Ark.Tools/samples/Ark.ReferenceProject/Core/Ark.Reference.Core.Tests/bin/Debug/net10.0/Ark.Reference.Core.Tests /home/REDACTED/work/Ark.Tools/Ark.Tools/samples/Ark.ReferenceProject/Core/Ark.Reference.Core.Tests/bin/Debug/net10.0/Ark.Reference.Core.Tests --server dotnettestcli --dotnet-test-pipe /tmp/1bfaab19fd704ca7ba37913ca807b03d (dns block)
    • Triggering command: /home/REDACTED/work/Ark.Tools/Ark.Tools/samples/Ark.ReferenceProject/Core/Ark.Reference.Core.Tests/bin/Debug/net10.0/Ark.Reference.Core.Tests /home/REDACTED/work/Ark.Tools/Ark.Tools/samples/Ark.ReferenceProject/Core/Ark.Reference.Core.Tests/bin/Debug/net10.0/Ark.Reference.Core.Tests --server dotnettestcli --dotnet-test-pipe /tmp/e0a2d5d30f6b451fbc08854d01ee9d1c (dns block)
  • rt.services.visualstudio.com
    • Triggering command: /home/REDACTED/work/Ark.Tools/Ark.Tools/samples/Ark.ReferenceProject/Core/Ark.Reference.Core.Tests/bin/Debug/net10.0/Ark.Reference.Core.Tests /home/REDACTED/work/Ark.Tools/Ark.Tools/samples/Ark.ReferenceProject/Core/Ark.Reference.Core.Tests/bin/Debug/net10.0/Ark.Reference.Core.Tests --server dotnettestcli --dotnet-test-pipe /tmp/4a2ac7f167804f76a58fcde32ecc51b5 (dns block)
    • Triggering command: /home/REDACTED/work/Ark.Tools/Ark.Tools/samples/Ark.ReferenceProject/Core/Ark.Reference.Core.Tests/bin/Debug/net10.0/Ark.Reference.Core.Tests /home/REDACTED/work/Ark.Tools/Ark.Tools/samples/Ark.ReferenceProject/Core/Ark.Reference.Core.Tests/bin/Debug/net10.0/Ark.Reference.Core.Tests --server dotnettestcli --dotnet-test-pipe /tmp/1bfaab19fd704ca7ba37913ca807b03d (dns block)
    • Triggering command: /home/REDACTED/work/Ark.Tools/Ark.Tools/samples/Ark.ReferenceProject/Core/Ark.Reference.Core.Tests/bin/Debug/net10.0/Ark.Reference.Core.Tests /home/REDACTED/work/Ark.Tools/Ark.Tools/samples/Ark.ReferenceProject/Core/Ark.Reference.Core.Tests/bin/Debug/net10.0/Ark.Reference.Core.Tests --server dotnettestcli --dotnet-test-pipe /tmp/e0a2d5d30f6b451fbc08854d01ee9d1c (dns block)

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

Copilot AI changed the title [WIP] Update non-major dependencies for improved stability fix(build): replace platform-specific dacpac copy with MSBuild Copy task Jan 22, 2026
Copilot AI requested a review from AndreaCuneo January 22, 2026 11:07
@AndreaCuneo

Copy link
Copy Markdown
Contributor

@copilot CI workflow still failed during tests. review and fix

Copilot AI and others added 2 commits January 22, 2026 12:20
After updating Microsoft.Data.SqlClient from 6.1.3 to 6.1.4, tests were failing with "The definition for user-defined data type 'udt_State_v2' has changed" error. This is caused by SQL Server's plan cache not being cleared after DROP/CREATE TYPE operations.

The fix adds DBCC FREEPROCCACHE command after recreating the user-defined table types to ensure SQL Server uses the new type definitions and clears any cached metadata from the old type definitions.

This resolves compatibility issues with Microsoft.Data.SqlClient 6.1.4's stricter schema validation.

Co-authored-by: AndreaCuneo <5227688+AndreaCuneo@users.noreply.github.com>
Add try-catch around DBCC FREEPROCCACHE to gracefully handle cases where:
- Insufficient permissions (e.g., Azure SQL Database restrictions)
- Other database environment constraints

The cache clearing is best-effort - if it fails, the cache will clear naturally over time. Added pragma to suppress analyzer warning since swallowing this exception is intentional.

Co-authored-by: AndreaCuneo <5227688+AndreaCuneo@users.noreply.github.com>

Copilot AI commented Jan 22, 2026

Copy link
Copy Markdown
Contributor Author

@copilot CI workflow still failed during tests. review and fix

Fixed in commit d97821c. The CI failure was caused by a different issue - after updating Microsoft.Data.SqlClient from 6.1.3 to 6.1.4, the stricter schema validation required clearing SQL Server's plan cache after recreating user-defined table types. Added DBCC FREEPROCCACHE with error handling to resolve the "udt_State_v2 has changed" error. All 62 ResourceWatcher tests now pass locally.

Copilot AI changed the title fix(build): replace platform-specific dacpac copy with MSBuild Copy task fix(build): resolve CI failures after dependency updates Jan 22, 2026
@AndreaCuneo
AndreaCuneo marked this pull request as ready for review January 22, 2026 13:59
@AndreaCuneo
AndreaCuneo requested a review from a team as a code owner January 22, 2026 13:59
@AndreaCuneo
AndreaCuneo merged commit bb90254 into renovate/all-minor-patch Jan 22, 2026
2 of 3 checks passed
@AndreaCuneo
AndreaCuneo deleted the copilot/sub-pr-601 branch January 22, 2026 13:59
@AndreaCuneo
AndreaCuneo restored the copilot/sub-pr-601 branch January 22, 2026 15:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants