Fix MAUI iOS simulator launch in VS Code#17857
Conversation
Ensure MAUI iOS simulator resources advertise an SDK-run project launch configuration for VS Code so they run through dotnet run instead of direct CoreCLR DLL launch. Preserve ordinary NoDebug project launch behavior and honor project launch configuration producers in DCP. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 17857Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 17857" |
Use the existing project launch mode and MAUI iOS run arguments to route simulator resources through dotnet run instead of adding a new IDE protocol field. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Reuse the same debug configuration wiring for MAUI SDK-run launches and the existing Blazor WebAssembly dotnet run fallback while keeping their argument builders separate. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Share the base dotnet run argument construction and avoid reparsing MAUI SDK-run properties while detecting iOS launches. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
adamint
left a comment
There was a problem hiding this comment.
Reviewed with four dedicated passes. I did not find any new, non-duplicate high-confidence issues to raise.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR fixes MAUI iOS simulator resource launch failures in VS Code by having the simulator resource opt out of IDE execution (via a non-"project" launch configuration type), so DCP runs it as a normal process using the ExecutableAnnotation-provided command (dotnet run). The VS Code extension no longer attempts to debug the simulator as a CoreCLR process.
Changes:
- MAUI iOS simulator resources now register a
"maui-ios-simulator"debug support type that VS Code does not claim support for, causing DCP to fall through to process execution with the resource's owndotnet runcommand ExecutableCreatornow honorsExecutableAnnotationon project resources (for command and working directory), and injects standard Aspire options (--configuration,--no-launch-profile) into existingdotnet runargs- The VS Code extension defers
dotNetServicecreation until it's actually needed and extracts a sharedconfigureDotNetRunDebugConfigurationhelper
Show a summary per file
| File | Description |
|---|---|
src/Aspire.Hosting.Maui/MauiiOSExtensions.cs |
Adds WithDebugSupport with "maui-ios-simulator" type so VS Code skips IDE execution |
src/Aspire.Hosting/Dcp/ExecutableCreator.cs |
Honors ExecutableAnnotation for command/working directory, adds AddDotnetRunArgsForExecutableAnnotatedProject helper, refactors ApplyProjectLaunchConfiguration |
extension/src/debugger/languages/dotnet.ts |
Defers dotNetService creation, extracts configureDotNetRunDebugConfiguration helper |
extension/src/test/dotnetDebugger.test.ts |
Adds test verifying ordinary project NoDebug mode uses compiled DLL path |
tests/Aspire.Hosting.Tests/Dcp/DcpExecutorTests.cs |
Adds tests for custom debug support producer and ExecutableAnnotation process execution |
tests/Aspire.Hosting.Maui.Tests/MauiPlatformExtensionsTests.cs |
Adds test verifying iOS simulator opts out of project IDE launch while keeping SDK run args |
Copilot's findings
- Files reviewed: 6/6 changed files
- Comments generated: 0
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
karolz-ms
left a comment
There was a problem hiding this comment.
Looks good but please address my suggestion before merging
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…e-17857-20260615 # Conflicts: # extension/src/extension.ts # src/Aspire.Hosting/Dcp/ExecutableCreator.cs # tests/Aspire.Hosting.Maui.Tests/MauiPlatformExtensionsTests.cs
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
Return the resolved endpoint URL from the E2E control bridge instead of echoing the optional command URL input. This lets resource-scoped openInIntegratedBrowser calls report the URL they actually opened. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Preserve the current main termination-refresh behavior in the refactored extension entry point before merging main. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Remove an unused resolveDefaultDevice local that was left behind from an earlier candidate-selection flow. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
Description
Fixes #17853
This makes Aspire's MAUI resources debuggable from the VS Code extension instead of falling back to a plain
dotnet runterminal launch. The useful user-facing path is: start the AppHost under the Aspire debugger, start a MAUI platform resource from the Aspire tree/dashboard flow, and get the MAUI extension's normal debugger behavior with the right target selected.The PR now covers Mac Catalyst, Windows, iOS simulator/device metadata, and Android emulator/device metadata. Android also avoids the bad stopped-emulator path where we passed
-p:AdbTarget=-s <avd-name>too early and the MAUI build failed withXA0010: Selected device is not running; for stopped emulators we select the MAUI active target and let the MAUI extension launch/resolve the emulator.User-facing usage
Existing MAUI AppHost code keeps the same shape:
When the VS Code MAUI extension is installed, Aspire now emits structured MAUI launch metadata through DCP and the VS Code extension maps that to a
type: "maui"debug configuration. IDEs that do not advertise support for themauilaunch type still get the process fallback path, so this should not break Visual Studio or other IDEs.Implementation notes:
type: "maui"launch metadata with project path, target framework, platform, target kind, device/runtime metadata, and relevant MSBuild properties.ms-dotnettools.dotnet-mauiis installed.environmentVariablesfrom debug config logs, and stops late-started child MAUI sessions if the parent Aspire session is disposed.extension.ts, and the extractedopenInIntegratedBrowsercommand now preserves the{ url }result expected by the E2E tests.Validation:
corepack yarn run compile-testsyarn run unit-test -- --config .vscode-test-short.mjs --grep "MAUI Debugger Extension Tests|E2E launch profile"yarn run unit-test -- --config .vscode-test-short.mjscorepack yarn run compilecorepack yarn run lintcorepack yarn run compile-e2edotnet test --project tests/Aspire.Hosting.Maui.Tests/Aspire.Hosting.Maui.Tests.csproj --no-launch-profile -- --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true"dotnet test --project tests/Aspire.Hosting.Tests/Aspire.Hosting.Tests.csproj --no-launch-profile -- --filter-method "*.MauiProjectWithExecutableAnnotationAndSupportedLaunchConfiguration_RunsInIdeWithLaunchMetadata" --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true"Checklist
<remarks />and<code />elements on your triple slash comments?