Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 16, 2025

Description

On macOS, the publish dialog fails to locate dacpac files when result.outputPath contains Windows-style backslashes (e.g., bin\Debug). Node.js path.join() on Unix doesn't convert these to forward slashes, producing malformed paths like /Users/.../project/bin\Debug/project.dacpac.

Changes:

  • Normalize path separators in readProjectProperties() by replacing backslashes with forward slashes before path.join() and path.isAbsolute() calls
  • Apply normalization to both relative and absolute paths
// Before: path.join() with Windows separators produces invalid Unix paths
const outputPath = path.join(projectDir, "bin\\Debug"); // → /home/user/project/bin\Debug

// After: normalize separators first
const normalized = "bin\\Debug".replace(/\\/g, "/");
const outputPath = path.join(projectDir, normalized); // → /home/user/project/bin/Debug

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

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:

  • update.code.visualstudio.com
    • Triggering command: /usr/local/bin/node /usr/local/bin/node ./out/test/unit/runTest.js --grep projectUtils (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>[Bug]: new publish dialog can't find dacpac on macos</issue_title>
<issue_description>### Description

On macos, if I try to publish a project using the new publish dialog (both script and publish actions) - the process can't progress past build because the path that the dacpac is being looked for has the filepath configured for Windows formatting.

Image

Steps to Reproduce

Image

Affected Area

  • Connection dialog (SQL Server | Azure browse/Fabric browse)
  • Query editor
  • Query results panel
  • Object Explorer
  • GitHub Copilot integration
  • Preview/Edit data
  • Table Designer
  • Schema Designer
  • Schema Compare
  • Local SQL Server Container provisioning
  • SQL database in Fabric provisioning
  • DACPAC/BACPAC export/import
  • SQL Database projects
  • Query Plan Visualizer
  • Other (please describe below)

If you selected "Other", please describe the affected area

No response

Environment Information

Version: 1.107.0
Commit: 618725e67565b290ba4da6fe2d29f8fa1d4e3622
Date: 2025-12-10T07:43:47.883Z
Electron: 39.2.3
ElectronBuildId: 12895514
Chromium: 142.0.7444.175
Node.js: 22.21.1
V8: 14.2.231.21-electron.0
OS: Darwin arm64 25.2.0

Image

Confirmation

  • I have searched existing issues and couldn't find a match
  • I want to work on this issue</issue_description>

<agent_instructions>The issue is that the slash direction in readProjectProperties() isn't corrected when it does this:

        const outputPath = path.isAbsolute(result.outputPath)
            ? result.outputPath
            : path.join(projectDir, result.outputPath);

For relative paths, it should fix the slash direction when doing path.join(projectDir, result.outputPath);</agent_instructions>

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


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits December 16, 2025 20:13
- Added path separator normalization in readProjectProperties() to convert Windows backslashes to forward slashes
- This fixes the issue where dacpac files couldn't be found on macOS when relative paths contained Windows-style backslashes
- Added test coverage for path normalization scenarios

Co-authored-by: Benjin <[email protected]>
- Updated to use normalizedOutputPath for path.isAbsolute() check
- This ensures absolute paths with Windows backslashes are also normalized
- Added test coverage for absolute paths with backslashes

Co-authored-by: Benjin <[email protected]>
import { readProjectProperties } from "../../src/publishProject/projectUtils";
import { SqlProjectsService } from "../../src/services/sqlProjectsService";

suite("projectUtils Tests", () => {
Copy link
Contributor

@ssreerama ssreerama Dec 16, 2025

Choose a reason for hiding this comment

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

@copilot We already have a publish‑project test file (PublishProjectWebViewController.test.ts). Instead of creating a new test file, could you add your tests to the existing one?

Copy link
Contributor

Choose a reason for hiding this comment

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

Actually, I think we should create a new file here. We try to keep the unit tests in identically-named files so that they're easy to locate.

Copy link
Contributor

@ssreerama ssreerama Dec 16, 2025

Choose a reason for hiding this comment

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

Can we publish this PR and test it with any MacOS, @Benjin IIRC you have the Mac right, can you test the fix, please!

Copilot AI changed the title [WIP] Fix dacpac path issue in new publish dialog on macOS Fix dacpac path resolution on macOS with Windows-style separators Dec 16, 2025
Copilot AI requested a review from Benjin December 16, 2025 20:20
@github-actions
Copy link

github-actions bot commented Dec 16, 2025

PR Changes

Category Target Branch PR Branch Difference
vscode-mssql VSIX 5285 KB 5285 KB ⚪ 0 KB ( 0% )
sql-database-projects VSIX 5668 KB 5668 KB ⚪ 0 KB ( 0% )

@codecov-commenter
Copy link

codecov-commenter commented Dec 16, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 65.90%. Comparing base (98a053c) to head (9bc9cd2).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #20824      +/-   ##
==========================================
- Coverage   65.90%   65.90%   -0.01%     
==========================================
  Files         210      210              
  Lines       19991    19992       +1     
  Branches     2596     2596              
==========================================
  Hits        13176    13176              
  Misses       6718     6718              
- Partials       97       98       +1     
Files with missing lines Coverage Δ
...xtensions/mssql/src/publishProject/projectUtils.ts 85.82% <100.00%> (+0.11%) ⬆️

... and 1 file with indirect coverage changes

🚀 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.

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.

[Bug]: new publish dialog can't find dacpac on macos

4 participants