Skip to content

Conversation

@captainsafia
Copy link
Member

Avoid have duplicate source declarations of the same RPC-transmitted types.

cc: @mitchdenny @adamint

Copilot AI review requested due to automatic review settings June 26, 2025 06:08
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 deduplicates the shared backchannel types between the CLI and the Hosting projects to avoid maintenance of duplicate source declarations.

  • Merges the backchannel data types into a single shared file with conditional namespace directives.
  • Removes duplicate type definitions from the CLI project.
  • Updates the CLI project file to compile the shared backchannel file.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
src/Aspire.Hosting/Backchannel/BackchannelDataTypes.cs Added conditional directives to set the namespace based on build.
src/Aspire.Cli/Backchannel/BackchannelDataTypes.cs Removed duplicate type definitions now shared by the Hosting project.
src/Aspire.Cli/Aspire.Cli.csproj Updated project file to include the shared BackchannelDataTypes.cs.

Copy link
Member

@DeagleGross DeagleGross left a comment

Choose a reason for hiding this comment

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

Looks good for me, but probably Eric can confirm if AOT works fully with such a change

@DeagleGross DeagleGross mentioned this pull request Jul 2, 2025
Copy link
Member

@mitchdenny mitchdenny left a comment

Choose a reason for hiding this comment

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

Will be good to get this in.

@captainsafia captainsafia force-pushed the safia/dedupe-backchannel-types branch from 12407f7 to 95ec908 Compare July 2, 2025 15:20
<PackageId>Aspire.Cli</PackageId>
<RollForward>Major</RollForward>
<PackageTags>aspire cli</PackageTags>
<DefineConstants>$(DefineConstants);CLI</DefineConstants>
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
<DefineConstants>$(DefineConstants);CLI</DefineConstants>

This isn't necessary. It is set above.

/// <summary>
/// Specifies the type of input for a publishing prompt input.
/// </summary>
internal enum InputType
Copy link
Member

Choose a reason for hiding this comment

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

Should this stay just in the CLI? I see there is another "public enum InputType" in Aspire.Hosting, which is used on that side. Having 2 in Aspire.Hosting will probably be confusing.

Copy link
Member

@eerhardt eerhardt left a comment

Choose a reason for hiding this comment

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

Just 2 nit-ish comments. Looks good beyond those!

<Compile Include="$(SharedDir)PathNormalizer.cs" Link="Utils\PathNormalizer.cs" />
<Compile Include="$(SharedDir)CircularBuffer.cs" Link="Utils\CircularBuffer.cs" />
<Compile Include="$(SharedDir)StringComparers.cs" Link="StringComparers.cs" />
<Compile Include="$(RepoRoot)src\Aspire.Hosting\Backchannel\BackchannelDataTypes.cs" Link="Backchannel\BackchannelDataTypes.cs" />
Copy link
Member

Choose a reason for hiding this comment

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

This causes problems in VS because there are 2 files with the same name in the same folder in the Solution Explorer. So only 1 file shows. Maybe rename src/Aspire.Cli/Backchannel/BackchannelDataTypes.cs => src/Aspire.Cli/Backchannel/CliBackchannelDataTypes.cs

@captainsafia captainsafia merged commit 590ede6 into main Jul 2, 2025
252 checks passed
@captainsafia captainsafia deleted the safia/dedupe-backchannel-types branch July 2, 2025 17:39
@github-actions github-actions bot locked and limited conversation to collaborators Aug 2, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants