Skip to content

Dev/mdaigle/mtp#4136

Draft
mdaigle wants to merge 9 commits intomainfrom
dev/mdaigle/mtp
Draft

Dev/mdaigle/mtp#4136
mdaigle wants to merge 9 commits intomainfrom
dev/mdaigle/mtp

Conversation

@mdaigle
Copy link
Copy Markdown
Contributor

@mdaigle mdaigle commented Apr 2, 2026

Description

Provide a summary of the changes being introduced. Important topics to cover
include:

  • Description of the functionality.
  • API changes, backwards compatibility, deprecations, etc.
  • Documentation, localization.
  • Bug fixes.
  • Code hygiene, refactoring, improvements.
  • Engineering processes (CI, pipelines, test coverage)

High quality descriptions will lead to a smoother review experience.

Issues

Link to any relevant issues, bugs, or discussions (e.g., Closes #123, Fixes issue #456).

Testing

Describe the automated tests (unit, integration) you created or modified.
Provide justification for any gap in automated testing. List any manual testing
steps that were performed to ensure the changes work. 

Guidelines

Please review the contribution guidelines before submitting a pull request:

Copilot AI review requested due to automatic review settings April 2, 2026 23:04
@github-project-automation github-project-automation bot moved this to To triage in SqlClient Board Apr 2, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the repo’s tooling and CI configuration to standardize on restoring and running local dotnet tools (notably pwsh) and adjusts a few test/build artifacts accordingly.

Changes:

  • Add powershell (pwsh) as a local dotnet tool and update multiple build targets to invoke pwsh via dotnet tool run.
  • Introduce a reusable pipeline step template to run dotnet tool restore, and wire it into CI/OneBranch plus the GitHub CodeQL workflow.
  • Quarantine a known-flaky manual test and remove Microsoft.DotNet.XUnitExtensions from the UnitTests project references.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
tools/targets/TrimDocsForIntelliSense.targets Switch XML doc trimming to run via dotnet tool run pwsh.
tools/targets/CompareMdsRefAssemblies.targets Remove the internal tool-restore target dependency for ApiCompat comparisons.
src/Microsoft.Data.SqlClient/tests/UnitTests/Microsoft.Data.SqlClient.UnitTests.csproj Remove Microsoft.DotNet.XUnitExtensions package reference (currently breaks compilation where its attributes are used).
src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/AdapterTest/AdapterTest.cs Mark one test as flaky with an issue link.
src/Microsoft.Data.SqlClient/ref/Microsoft.Data.SqlClient.csproj Switch TrimDocs invocation to dotnet tool run pwsh.
eng/pipelines/steps/tool-restore.yml Add a reusable dotnet tool restore step template.
eng/pipelines/onebranch/jobs/build-signed-mds-package-job.yml Invoke tool restore before building.
eng/pipelines/onebranch/jobs/build-signed-csproj-package-job.yml Invoke tool restore before building.
eng/pipelines/common/templates/jobs/ci-run-tests-job.yml Invoke tool restore before building/tests.
eng/pipelines/common/templates/jobs/ci-build-nugets-job.yml Invoke tool restore before building.
dotnet-tools.json Add powershell tool (pwsh) to the local tool manifest.
.github/workflows/codeql.yml Restore dotnet tools before CodeQL manual build.
.github/plans/plan-migrateToMtp.prompt.md Add an internal planning prompt doc for MTP migration.
Comments suppressed due to low confidence (1)

src/Microsoft.Data.SqlClient/tests/UnitTests/Microsoft.Data.SqlClient.UnitTests.csproj:59

  • UnitTests sources use Xunit extensions such as PlatformSpecific/SkipOnPlatform/TestPlatforms (e.g., SimulatedServerTests/ConnectionTests.cs, AlwaysEncrypted/NativeColumnEncryptionKeyBaseline.cs). Removing the Microsoft.DotNet.XUnitExtensions PackageReference here will cause compile-time missing type errors. Re-add the package reference (preferred), or remove/replace those attributes across UnitTests so the project no longer depends on that package.
  <!-- References for netframework -->
  <ItemGroup Condition="'$(TargetFramework)' == 'net462'">
    <Reference Include="System.Transactions" />

    <PackageReference Include="Microsoft.Data.SqlClient.SNI" />
    <PackageReference Include="Microsoft.NET.Test.Sdk" />
    <PackageReference Include="Microsoft.SqlServer.Server" />
    <PackageReference Include="System.Configuration.ConfigurationManager" />
    <PackageReference Include="System.Runtime.InteropServices.RuntimeInformation" />
    <PackageReference Include="xunit" />
    <PackageReference Include="xunit.runner.console"
@@ -3,7 +3,6 @@ The .NET Foundation licenses this file to you under the MIT license. -->
<Project>
<!-- This target runs after Build, and trims XML documentation generated in the $(OutputPath) of the project where this target is included.-->
<Target Name="TrimDocsForIntelliSense" AfterTargets="Build" Condition="'$(GenerateDocumentationFile)' == 'true'">
Copy link

Copilot AI Apr 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This target now relies on dotnet tool run pwsh, which will fail if local tools haven’t been restored yet (common on first build after clone). Consider either (1) restoring tools as part of the build flow before this target runs, or (2) falling back to system-installed pwsh/powershell.exe when available and emit a clear error instructing dotnet tool restore otherwise.

Suggested change
<Target Name="TrimDocsForIntelliSense" AfterTargets="Build" Condition="'$(GenerateDocumentationFile)' == 'true'">
<Target Name="TrimDocsForIntelliSense" AfterTargets="Build" Condition="'$(GenerateDocumentationFile)' == 'true'">
<Exec Command="dotnet tool restore" />
Copilot uses AI. Check for mistakes.
Comment on lines 51 to 56
<PropertyGroup>
<PowerShellCommand Condition="'$(OS)' == 'Windows_NT'">powershell.exe</PowerShellCommand>
<PowerShellCommand Condition="'$(OS)' != 'Windows_NT'">pwsh</PowerShellCommand>
<PowerShellCommand>
$(PowerShellCommand)
dotnet tool run pwsh
-NonInteractive
-ExecutionPolicy Unrestricted
-Command "$(RepoRoot)tools\intellisense\TrimDocs.ps1 -inputFile '$(DocumentationFile)' -outputFile '$(DocumentationFile)'"
Copy link

Copilot AI Apr 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ref build’s TrimDocs step now shells out via dotnet tool run pwsh. If the local tool manifest hasn’t been restored, building the ref project will fail late in the build (after compilation) with a missing-tool error. Consider adding a precondition/error message (or performing tool restore earlier in the repo build) to make this failure mode clearer and avoid surprising local builds.

Copilot uses AI. Check for mistakes.
Comment on lines 148 to 152
<!-- _RunRefApiCompat -->
<!-- ================================================================== -->
<Target Name="_RunRefApiCompat"
DependsOnTargets="_DownloadBaselinePackage;_RestoreTools;_BuildLegacyRefNetFx;_BuildLegacyRefNetCore;_BuildNewRefProject">
DependsOnTargets="_DownloadBaselinePackage;_BuildLegacyRefNetFx;_BuildLegacyRefNetCore;_BuildNewRefProject">

Copy link

Copilot AI Apr 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing the _RestoreTools dependency means CompareMdsRefAssemblies now assumes the local tool manifest has already been restored (for apicompat). This is a behavior change that can break the documented one-liner usage unless callers remember to run dotnet tool restore first. Consider keeping a tool-restore dependency (optionally gated behind a property) or adding a clear error/message when the tool isn’t available.

Copilot uses AI. Check for mistakes.
Comment on lines +7 to +14
# Restores dotnet CLI tools defined in dotnet-tools.json.
# This step should be invoked after install-dotnet.yml and before any build
# steps that depend on the restored tools (e.g. pwsh, apicompat).

steps:
- script: dotnet tool restore
displayName: Restore .NET Tools
workingDirectory: $(Build.SourcesDirectory)
Copy link

Copilot AI Apr 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR description is still the default template and doesn’t describe the intent of these changes (tooling/pipeline updates, test package changes, flaky test quarantine). Please update the PR description with a short summary and testing notes so reviewers can validate scope and impact.

Copilot uses AI. Check for mistakes.
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 3, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 66.39%. Comparing base (60d4b92) to head (4e94e53).
⚠️ Report is 15 commits behind head on main.

❗ There is a different number of reports uploaded between BASE (60d4b92) and HEAD (4e94e53). Click for more details.

HEAD has 1 upload less than BASE
Flag BASE (60d4b92) HEAD (4e94e53)
CI-SqlClient 1 0
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4136      +/-   ##
==========================================
- Coverage   73.22%   66.39%   -6.83%     
==========================================
  Files         280      274       -6     
  Lines       43000    65782   +22782     
==========================================
+ Hits        31486    43678   +12192     
- Misses      11514    22104   +10590     
Flag Coverage Δ
CI-SqlClient ?
PR-SqlClient-Project 66.39% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants