-
Notifications
You must be signed in to change notification settings - Fork 725
Reenable extensions interaction service #10047
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reenable extensions interaction service #10047
Conversation
Reuse the same Json source generation context. Add ExtensionBackchannel types to it. Need to suppress a RDC warning due to EventHandlers on the Rpc Target object needing to call MakeGenericMethod, but we aren't using EventHandlers so it can be suppressed.
There was a problem hiding this 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 re-enables the extension interaction service with native AOT support, reuses existing JSON source-gen context, and wires through an OpenNewProject flow tied to template creation.
- Introduces extension-related configuration keys and backchannel RPC types
- Updates
ITemplate.ApplyTemplateAsyncto return aTemplateResultcarrying exit code and output path - Refactors
Program.csto register either console or extension-based interaction services
Reviewed Changes
Copilot reviewed 56 out of 93 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/Aspire.Cli.Tests/TestServices/TestConsoleInteractionService.cs | Added OpenNewProject stub to satisfy new interface method |
| src/Shared/KnownConfigNames.cs | Added constants for extension endpoint, prompt flag, token, and cert |
| src/Aspire.Cli/Utils/StringUtils.cs | Introduced RemoveSpectreFormatting extension method with regex |
| src/Aspire.Cli/Templating/ITemplate.cs | Changed return type of ApplyTemplateAsync to TemplateResult |
| src/Aspire.Cli/Templating/DotNetTemplateFactory.cs | Adjusted helper methods to return TemplateResult |
| src/Aspire.Cli/Templating/CallbackTemplate.cs | Adapted callback signature to use TemplateResult |
| src/Aspire.Cli/Program.cs | Refactored to async build, added AddInteractionServices helper |
| src/Aspire.Cli/Interaction/IInteractionService.cs | Added OpenNewProject method |
| src/Aspire.Cli/Interaction/ExtensionInteractionService.cs | Implemented extension backchannel queuing and prompt forwarding |
| src/Aspire.Cli/Interaction/ConsoleInteractionService.cs | Added empty OpenNewProject implementation |
| src/Aspire.Cli/Commands/RunCommand.cs | Expanded OperationCanceledException catch to include None tokens |
| src/Aspire.Cli/Commands/NewCommand.cs | Switched to using TemplateResult, calls OpenNewProject if set |
| src/Aspire.Cli/Backchannel/ExtensionRpcTarget.cs | New RPC target for version and prompt validation |
| src/Aspire.Cli/Backchannel/ExtensionBackchannel.cs | Full client implementation for extension RPC backchannel |
| src/Aspire.Cli/Backchannel/BackchannelJsonSerializerContext.cs | Added source-generated JSON formatter context |
| src/Aspire.Cli/Backchannel/BackchannelDataTypes.cs | Added DisplayLineState type for backchannel payloads |
| src/Aspire.Cli/Backchannel/AppHostIncompatibleException.cs | Made exception non-sealed to unify with extension patterns |
| src/Aspire.Cli/Backchannel/AppHostBackchannel.cs | Switched to JSON source-generated formatter (removed manual method) |
| extension/src/utils/vsc.ts | Updated isWorkspaceOpen to optionally suppress error popup |
| extension/src/utils/terminal.ts | Inject extension env vars (token, cert) into new terminal |
| extension/src/test/rpc/e2eServerTests.test.ts | Changed RPC e2e tests to use TLS client for certificate-based auth |
| extension/src/server/rpcServer.ts | Converted RPC server to use TLS, error handling, included cert field |
| extension/src/server/interactionService.ts | Added openProject RPC endpoint |
| extension/src/server/cert-util.ts | New helper to generate self-signed certs |
| extension/src/constants/strings.ts | Added rpcServerError localized string |
| extension/src/commands/new.ts | Removed pre-check to allow extension to open folder |
| extension/package.json | Added node-forge and corresponding types dependency |
| extension/package.nls.* (all locales) | Updated localization JSONs to include rpcServerError entries |
Files not reviewed (1)
- src/Aspire.Cli/Resources/ErrorStrings.Designer.cs: Language not supported
Comments suppressed due to low confidence (1)
src/Aspire.Cli/Commands/NewCommand.cs:96
- This new
OpenNewProjectcall isn’t currently covered by existing tests. Consider adding a unit test to verify that callingnewwith an output path invokesOpenNewProjecton the interaction service.
_interactionService.OpenNewProject(templateResult.OutputPath);
| } | ||
| } | ||
| catch (OperationCanceledException ex) when (ex.CancellationToken == cancellationToken) | ||
| catch (OperationCanceledException ex) when (ex.CancellationToken == cancellationToken || ex.CancellationToken == CancellationToken.None) |
Copilot
AI
Jun 25, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The added condition ex.CancellationToken == CancellationToken.None may inadvertently swallow unrelated cancellations. Consider limiting the catch to the passed-in token only.
| catch (OperationCanceledException ex) when (ex.CancellationToken == cancellationToken || ex.CancellationToken == CancellationToken.None) | |
| catch (OperationCanceledException ex) when (ex.CancellationToken == cancellationToken) |
…nteractionService
Remove Exception from the wire payload since it can't be safely STJ serialized using the source generator. Enable Configuration Binder source generator in the Aspire.Cli.
|
needs .localization/out and dist files removed from tracking before merge |
Description
This reverts aab8668.
Re-enabling Initial extension interaction service (#9927) with supporting native AOT.
Reuse the same Json source generation context. Add ExtensionBackchannel types to it.
Need to suppress a RDC warning due to EventHandlers on the Rpc Target object needing to call MakeGenericMethod, but we aren't using EventHandlers so it can be suppressed.
Fixes # 10029