Skip to content

Bundling sqltoolsserivce with extension.#21631

Open
aasimkhan30 wants to merge 18 commits intomainfrom
aasim/fix/portableDotnet
Open

Bundling sqltoolsserivce with extension.#21631
aasimkhan30 wants to merge 18 commits intomainfrom
aasim/fix/portableDotnet

Conversation

@aasimkhan30
Copy link
Contributor

@aasimkhan30 aasimkhan30 commented Mar 14, 2026

Description

Fixes: #17992

  1. Packaging is now split into two modes:

    • Offline packages are OS-specific and bundle a self-contained SQL Tools Service, so they do not depend on the .NET runtime extension.
    • The online package bundles the portable/framework-dependent SQL Tools Service and depends on ms-dotnettools.vscode-dotnet-runtime.
    image
  2. On activation, the extension now resolves SQL Tools Service in this order:

    • Use a platform-specific self-contained STS if present (offline VSIX scenario).
    • Otherwise use an existing portable STS if present.
    • Otherwise download the portable STS.
  3. When the portable STS is used, the extension acquires a .NET 8 runtime via dotnet.acquire from ms-dotnettools.vscode-dotnet-runtime.

  4. If portable STS download fails or .NET runtime acquisition fails, the user is shown an error with guidance to install the offline VSIX.

image

Tasks left.

  • I had to refresh azure token cache to connect to Entra auth server. Need to investigate more on it.
  • Clean up error messages.
  • Clean up service downloader util class
  • Clean up other services like flatfileimport to use the runtime instead of downloading their own runtime.

Code Changes Checklist

  • New or updated unit tests added
  • All existing tests pass (npm run test)
  • Code follows contributing guidelines
  • Telemetry/logging updated if relevant
  • No regressions or UX breakage

Reviewers: Please read our reviewer guidelines

Aasim Khan added 3 commits March 13, 2026 08:55
- Updated package.json to include ms-dotnettools.vscode-dotnet-runtime as a dependency.
- Modified package-extension.js to handle portable SQL Tools Service packaging.
- Introduced dotnetRuntimeProvider for acquiring .NET runtime paths.
- Enhanced server.ts to prioritize platform-specific paths and fall back to portable paths.
- Added unit tests for dotnetRuntimeProvider and updated existing tests for server functionality.
@github-actions
Copy link

github-actions bot commented Mar 14, 2026

PR Changes

Category Target Branch PR Branch Difference
vscode-mssql VSIX 6454 KB 100366 KB 🔴 93912 KB ( 1455% )
sql-database-projects VSIX 7062 KB 6405 KB 🟢 -657 KB ( -9% )
data-workspace VSIX 535 KB 535 KB ⚪ 0 KB ( 0% )
keymap VSIX 7 KB 7 KB ⚪ 0 KB ( 0% )

@codecov-commenter
Copy link

codecov-commenter commented Mar 14, 2026

Codecov Report

❌ Patch coverage is 60.54054% with 73 lines in your changes missing coverage. Please review.
✅ Project coverage is 73.02%. Comparing base (27a481d) to head (c9568a6).

Files with missing lines Patch % Lines
...ensions/mssql/src/languageservice/serviceclient.ts 13.15% 66 Missing ⚠️
extensions/mssql/src/constants/locConstants.ts 68.75% 5 Missing ⚠️
...mssql/src/languageservice/dotnetRuntimeProvider.ts 96.36% 2 Missing ⚠️

❌ Your patch status has failed because the patch coverage (60.54%) is below the target coverage (70.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #21631      +/-   ##
==========================================
- Coverage   73.04%   73.02%   -0.02%     
==========================================
  Files         327      328       +1     
  Lines       99044    99205     +161     
  Branches     5602     5613      +11     
==========================================
+ Hits        72346    72448     +102     
- Misses      26698    26757      +59     
Files with missing lines Coverage Δ
extensions/mssql/src/configurations/config.ts 100.00% <100.00%> (ø)
extensions/mssql/src/constants/constants.ts 100.00% <100.00%> (ø)
extensions/mssql/src/languageservice/server.ts 97.29% <100.00%> (+0.74%) ⬆️
extensions/mssql/src/models/platform.ts 81.57% <100.00%> (+0.22%) ⬆️
...mssql/src/languageservice/dotnetRuntimeProvider.ts 96.36% <96.36%> (ø)
extensions/mssql/src/constants/locConstants.ts 75.91% <68.75%> (-0.04%) ⬇️
...ensions/mssql/src/languageservice/serviceclient.ts 40.34% <13.15%> (-3.11%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

run: |
cd extensions/mssql
vsce package
yarn package
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Using our custom packing script to bundle the portable runtime.

},
installDir: "./sqltoolsservice/{#version#}/{#platform#}",
executableFiles: [
"MicrosoftSqlToolsServiceLayer.dll",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

DLL have a higher priority over .exe or .sh files as portable STS just has dlls.

"extensionDependencies": [
"vscode.sql"
"vscode.sql",
"ms-dotnettools.vscode-dotnet-runtime"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We need a hard dependency on runtime extension as launching without it should fail extension activation.

kburtram
kburtram previously approved these changes Mar 18, 2026
Copy link
Member

@kburtram kburtram left a comment

Choose a reason for hiding this comment

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

I wonder if we should do this in the insider/prerelease build for a while before pushing to stable?

@aasimkhan30 aasimkhan30 marked this pull request as ready for review March 19, 2026 23:17
Copilot AI review requested due to automatic review settings March 19, 2026 23:17
Copy link
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 MSSQL extension packaging and activation flow to support bundling SQL Tools Service (STS) directly in OS-specific “offline” VSIX packages, while keeping an “online” package that uses a portable/framework-dependent STS and acquires a .NET runtime via ms-dotnettools.vscode-dotnet-runtime.

Changes:

  • Introduces a portable STS runtime option and activation logic that prefers bundled platform-specific STS, then portable STS, then download.
  • Adds a DotnetRuntimeProvider that uses dotnet.acquire to obtain a .NET 8 runtime when launching framework-dependent STS/.dll services.
  • Updates packaging scripts and CI workflows to build online/offline VSIX variants and package via yarn package.

Reviewed changes

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

Show a summary per file
File Description
localization/xliff/vscode-mssql.xlf Adds new localizable strings for runtime/service startup error UX actions.
extensions/mssql/l10n/bundle.l10n.json Updates runtime localization bundle with the new strings.
extensions/mssql/src/models/platform.ts Adds Runtime.Portable and display name handling.
extensions/mssql/src/configurations/config.ts Adds portable STS download filename + .NET runtime version; adjusts executable file search order.
extensions/mssql/src/constants/constants.ts Adds constants for dotnet runtime extension/command and offline VSIX URL.
extensions/mssql/src/constants/locConstants.ts Adds ServiceClient localized strings for runtime/service startup failures and actions.
extensions/mssql/src/languageservice/dotnetRuntimeProvider.ts New provider to acquire a .NET runtime via dotnet.acquire.
extensions/mssql/src/languageservice/server.ts Updates STS path resolution priority: platform-specific first, then portable; handles missing paths more safely.
extensions/mssql/src/languageservice/serviceclient.ts Switches download fallback to portable STS and launches .dll services via acquired dotnet; adds failure UX with offline VSIX guidance.
extensions/mssql/scripts/package-extension.js Splits packaging into online (portable STS) vs offline (platform self-contained STS) and adjusts manifest deps for offline packages.
extensions/mssql/test/unit/serviceInstallerUtils.test.ts Removes commented-out unused test snippet.
extensions/mssql/test/unit/serviceClient.test.ts Updates SqlToolsServiceClient construction to include the new runtime provider dependency.
extensions/mssql/test/unit/server.test.ts Adds/updates tests for new server path priority and download behavior.
extensions/mssql/test/unit/dotnetRuntimeProvider.test.ts Adds unit tests for dotnet runtime acquisition behavior.
extensions/mssql/test/e2e/utils/launchVscodeWithMsSqlExt.ts Installs the dotnet runtime extension before launch; refactors VSIX/extension install flow.
.github/workflows/build-and-test.yml Switches packaging steps to yarn package; adds baseline size reporting for keymap VSIX.
.github/workflows/publish-baseline.yml Switches baseline packaging steps to yarn package.

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.

Integrate with .Net Install Tool to use shared runtime

4 participants