Skip to content

fix(vscode): preserve platform so .NET Framework shows in custom-code dropdown#9366

Merged
lambrianmsft merged 2 commits into
Azure:hotfix/v5.961from
lambrianmsft:lambrianmsft-net-framework-custom-code-fix
Jul 3, 2026
Merged

fix(vscode): preserve platform so .NET Framework shows in custom-code dropdown#9366
lambrianmsft merged 2 commits into
Azure:hotfix/v5.961from
lambrianmsft:lambrianmsft-net-framework-custom-code-fix

Conversation

@lambrianmsft

@lambrianmsft lambrianmsft commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Commit Type

  • feature - New functionality
  • fix - Bug fix
  • refactor - Code restructuring without behavior change
  • perf - Performance improvement
  • docs - Documentation update
  • test - Test-related changes
  • chore - Maintenance/tooling

Risk Level

  • Low - Minor changes, limited scope
  • Medium - Moderate changes, some user impact
  • High - Major changes, significant user/system impact

What & Why

TL;DR: On Windows, the custom-code .NET Version dropdown stopped offering the Windows-only .NET Framework (net472) option in both the createWorkspace and createProject VS Code webview wizards. Only .NET 8 and .NET 10 showed.

The option is gated on redux createWorkspace.platform === 'win32', but platform ended up null, so the option was hidden. The extension host was already correct — it always sends platform: os.platform() and separator in the initialize_frame payload for every create flow. Two reducer bugs dropped that value:

  • createWorkspace flow: initializeWorkspace set platform, but the flow wrappers' mount-time resetState(undefined) wiped it back to null.
  • createProject flow: the webview dispatches only initializeProject, which never read platform/separator from its payload, so platform stayed null.

Fix (both in createWorkspaceSlice.ts):

  • resetState now always preserves the host-environment values platform and separator (regardless of preserveLogicAppData), via a single-merge Object.assign(state, initialState, preserved).
  • initializeProject now also captures platform and separator from its payload.

No changes to webviewCommunication.tsx, the flow wrappers, or the host handler — the createProject and createWorkspace flows are kept separate.

Impact of Change

  • Users: On Windows, the .NET Framework option is restored in the custom-code .NET Version dropdown for both the create-workspace and create-project wizards. No change on macOS/Linux (still .NET 8 / .NET 10).
  • Developers: resetState no longer wipes host-environment fields (platform, separator); initializeProject now reads them from its payload. Redux reducer contract clarified and locked by new tests.
  • System: No architecture, performance, or dependency changes. Purely a redux state-preservation fix in the VS Code webview.

Test Plan

  • Unit tests added/updated
  • E2E tests added/updated
  • Manual testing completed
  • Tested in:

New state/__test__/createWorkspaceSlice.test.ts locks the preservation behavior and positive Windows sequences for both flows. Strengthened dotNetFrameworkStep.test.tsx asserts the exact per-platform option set (win32 -> Framework/8/10; darwin/linux/null -> 8/10). All tests pass locally; biome clean.

Contributors

Screenshots/Videos

The only user-visible change is the .NET Framework entry reappearing in the .NET Version dropdown on Windows; behavior is covered by the per-platform option-set unit assertions in dotNetFrameworkStep.test.tsx.

@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

🤖 AI PR Validation Report

PR Review Results

Thank you for your submission! Here's detailed feedback on your PR title and body compliance:

PR Title

  • Current: fix(vscode): preserve platform so .NET Framework shows in custom-code dropdown
  • Issue: None — this is a clear, specific, and appropriately scoped title.
  • Recommendation: No change needed.

Commit Type

  • Properly selected (fix).
  • Only one commit type is selected, which is correct.

Risk Level

  • Properly selected (Low), and it matches the risk:low label.

What & Why

  • Current: Detailed and clear; it explains the bug, root cause, and fix path.
  • Issue: None.
  • Recommendation: No change needed.

Impact of Change

  • The section clearly describes user, developer, and system impact.
  • Recommendation:
    • Users: Good as written.
    • Developers: Good as written.
    • System: Good as written.

Test Plan

  • Unit tests are added/updated in the diff, which satisfies the test-plan requirement.
  • Manual testing is also documented.

Contributors

  • Contributors are listed appropriately.

⚠️ Screenshots/Videos

  • No screenshots or videos are included.
  • This is acceptable, but since the change affects a visible dropdown option, adding a screenshot would be helpful for reviewers.

Summary Table

Section Status Recommendation
Title No change needed
Commit Type No change needed
Risk Level No change needed
What & Why No change needed
Impact of Change No change needed
Test Plan No change needed
Contributors No change needed
Screenshots/Videos ⚠️ Optional, but a screenshot would help for this UI change

Overall: this PR passes review for title/body compliance. The advised risk level is consistent with the submitter’s low assessment.


Last updated: Fri, 03 Jul 2026 04:39:17 GMT

@lambrianmsft lambrianmsft added risk:low Low risk change with minimal impact and removed needs-pr-update labels Jul 2, 2026
… dropdown

The custom-code ".NET Version" dropdown (DotNetFrameworkStep) hid the
Windows-only .NET Framework (net472) option because redux
createWorkspace.platform ended up null in both the createWorkspace and
createProject webview wizards.

Two bugs, both in createWorkspaceSlice.ts:

- createWorkspace flow: initializeWorkspace set platform, but the flow
  wrappers' mount-time resetState(undefined) wiped it back to null.
  Fix: resetState now always preserves the host-environment values
  platform and separator, regardless of preserveLogicAppData.

- createProject flow: the webview dispatches only initializeProject,
  which never read platform/separator from its payload, so platform
  stayed null. Fix: initializeProject now also captures platform and
  separator (the host already sends them in initialize_frame).

Adds reducer-level tests (createWorkspaceSlice.test.ts) locking the
preservation behavior and positive Windows sequences for both flows,
and strengthens dotNetFrameworkStep.test.tsx to assert the exact
per-platform option set (win32 -> Framework/8/10; others -> 8/10).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@lambrianmsft lambrianmsft force-pushed the lambrianmsft-net-framework-custom-code-fix branch from f171411 to df1a8b7 Compare July 2, 2026 23:03
@lambrianmsft lambrianmsft enabled auto-merge (squash) July 3, 2026 04:38
@lambrianmsft lambrianmsft merged commit 6c5c593 into Azure:hotfix/v5.961 Jul 3, 2026
59 of 61 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-validated risk:low Low risk change with minimal impact

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants