Skip to content

Add net472 support for SqlCore library and update conditional compilation fixes#2635

Merged
bruzel merged 6 commits intomainfrom
bruzel/SCRefactor1
Apr 1, 2026
Merged

Add net472 support for SqlCore library and update conditional compilation fixes#2635
bruzel merged 6 commits intomainfrom
bruzel/SCRefactor1

Conversation

@bruzel
Copy link
Copy Markdown
Contributor

@bruzel bruzel commented Mar 27, 2026

Description

This PR is the first step in a multi‑PR effort to migrate schema comparison logic into a reusable SqlCore NuGet package, which can later be consumed by other clients (like SSMS).

In this PR, we introduce .NET Framework 4.7.2 as an additional compilation target for the SqlCore library (and its dependent libraries) to enable compatibility with SSMS. This requires a small number of conditional compilation adjustments, all of which are non‑functional and do not affect runtime behavior. No additional test coverage is added in this PR, as existing tests are expected to continue working unchanged.

The overall migration plan is documented here:
📄 Schema Compare Migration Plan
https://github.com/microsoft/sqltoolsservice/blob/copilot/focus-new-interfaces-service-project/docs/schema-compare-migration-plan.md

Code Changes Checklist

  • New or updated unit tests added
  • All existing tests pass (dotnet test)
  • Code follows contributing guidelines
  • Logging/telemetry updated if relevant
  • No protocol or behavioral regressions

Reviewers: Please read our reviewer guidelines

Copilot AI and others added 2 commits March 27, 2026 08:56
- Add net472 to Hosting, VSCode, and SqlCore project TargetFrameworks
- Change ProtocolEndpoint.cs WaitAsync guard from NETSTANDARD2_0 to !NET6_0_OR_GREATER
- Update Logger.cs to prefer Environment.ProcessId under NET6_0_OR_GREATER
- Update SqlClientEventListener.cs conditionals for net472 support and OSThreadId
- Guard RequiresUnreferencedCode/RequiresDynamicCode in KernelJsonSchemaBuilder.cs with NET6_0_OR_GREATER

Co-authored-by: bruzel <3098798+bruzel@users.noreply.github.com>
Agent-Logs-Url: https://github.com/microsoft/sqltoolsservice/sessions/a3da12b3-a743-44ed-ab4e-6a392721df54
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

Adds .NET Framework 4.7.2 (net472) as an additional target for the emerging SqlCore package and key dependent libraries, enabling compatibility with .NET Framework consumers such as SSMS. The PR also updates a few conditional compilation blocks to avoid APIs/attributes that aren’t available on net472, while keeping runtime behavior effectively unchanged.

Changes:

  • Multi-target Microsoft.SqlTools.SqlCore and Microsoft.SqlTools.Hosting for net472 alongside existing TFMs.
  • Multi-target Microsoft.SqlTools.Connectors.VSCode for net472 and gate trimming/AOT-related attributes behind NET6_0_OR_GREATER.
  • Adjust framework-conditional code paths for process/thread ID logging and Task.WaitAsync usage.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/Microsoft.SqlTools.SqlCore/Microsoft.SqlTools.SqlCore.csproj Adds net472 to SqlCore target frameworks.
src/Microsoft.SqlTools.Hosting/Microsoft.SqlTools.Hosting.csproj Adds net472 to Hosting target frameworks.
src/Microsoft.SqlTools.Hosting/Utility/SqlClientEventListener.cs Makes EventCounter filtering and thread ID logging compile across net472 / netstandard2.0 / net8.
src/Microsoft.SqlTools.Hosting/Utility/Logger.cs Uses Environment.ProcessId only on NET6_0_OR_GREATER, fallback otherwise for net472 compatibility.
src/Microsoft.SqlTools.Hosting/Hosting/Protocol/ProtocolEndpoint.cs Uses Task.WaitAsync only when available (NET6_0_OR_GREATER).
src/Microsoft.SqlTools.Connectors.VSCode/Microsoft.SqlTools.Connectors.VSCode.csproj Adds net472 as an additional target framework.
src/Microsoft.SqlTools.Connectors.VSCode/InternalUtilities/src/Schema/KernelJsonSchemaBuilder.cs Wraps trimming/AOT attributes to avoid missing-attribute compile failures on net472.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@bruzel
Copy link
Copy Markdown
Contributor Author

bruzel commented Mar 27, 2026

@microsoft-github-policy-service agree company="Microsoft"

Comment thread src/Microsoft.SqlTools.SqlCore/Microsoft.SqlTools.SqlCore.csproj Outdated
Copilot AI review requested due to automatic review settings March 31, 2026 18:24
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

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/Microsoft.SqlTools.Hosting/Utility/SqlClientEventListener.cs
Benjin
Benjin previously approved these changes Mar 31, 2026
Copilot AI review requested due to automatic review settings March 31, 2026 21:51
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

Copilot reviewed 8 out of 8 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@bruzel bruzel merged commit 8daa1c7 into main Apr 1, 2026
10 checks passed
@bruzel bruzel deleted the bruzel/SCRefactor1 branch April 1, 2026 08:57
@bruzel bruzel mentioned this pull request Apr 8, 2026
5 tasks
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.

5 participants