Fix template version parsing for .NET 10.0 SDK separator change#14285
Fix template version parsing for .NET 10.0 SDK separator change#14285
Conversation
Co-authored-by: JamesNK <303201+JamesNK@users.noreply.github.com>
|
@copilot Refactor into one parameterized unit test |
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 14285Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 14285" |
|
@mitchdenny @davidfowl @DamianEdwards I've never touched this area before. Why did I get a |
Co-authored-by: JamesNK <303201+JamesNK@users.noreply.github.com>
Refactored into a single parameterized test using 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:
If you need me to access, download, or install something from one of these locations, you can either:
|
There was a problem hiding this comment.
Pull request overview
This PR fixes a parsing failure in the Aspire CLI when using .NET 10.0 SDK, which changed the template version separator from :: to @ in dotnet new install output.
Changes:
- Updated
TryParsePackageVersionFromStdoutto parse both@(new format) and::(old format) separators with fallback for backward compatibility - Changed method visibility from
privatetointernalto enable unit testing - Added 4 comprehensive unit tests covering new format, old format, missing success line, and invalid format scenarios
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/Aspire.Cli/DotNet/DotNetCliRunner.cs | Updated parsing logic to handle both @ and :: separators with fallback; changed method visibility to internal |
| tests/Aspire.Cli.Tests/DotNet/DotNetCliRunnerTests.cs | Added 4 unit tests covering new format, legacy format, and error cases |
|
@JamesNK what .NET 10 SDK version do you have installed? I'm wondering if you picked up a 10.0.200 preview from VS insiders/dogfood and the change came with that. |
|
|
10.0.102:
10.0.200-preview.0.26079.118:
Confirmed that it's a change in new SDK. |
|
@JamesNK cool that confirms it then. Do your changes support both formats? |
|
Yes [Theory]
[InlineData("Success: Aspire.ProjectTemplates@13.2.0-preview.1.26101.12 installed the following templates:", true, "13.2.0-preview.1.26101.12")] // New .NET 10.0 SDK format with @ separator
[InlineData("Success: Aspire.ProjectTemplates::13.2.0-preview.1.26101.12 installed the following templates:", true, "13.2.0-preview.1.26101.12")] // Old SDK format with :: separator
[InlineData("Some other output", false, null)] // Missing success line
[InlineData("Success: Aspire.ProjectTemplates installed the following templates:", false, null)] // Invalid format without version separator
public void TryParsePackageVersionFromStdout_ParsesCorrectly(string stdout, bool expectedResult, string? expectedVersion) |
* Initial plan * Fix template version parsing to support @ separator for .NET 10.0 SDK Co-authored-by: JamesNK <303201+JamesNK@users.noreply.github.com> * Refactor into parameterized test using Theory and InlineData Co-authored-by: JamesNK <303201+JamesNK@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: JamesNK <303201+JamesNK@users.noreply.github.com>
…or change (#14698) * Fix template version parsing for .NET 10.0 SDK separator change (#14285) * Initial plan * Fix template version parsing to support @ separator for .NET 10.0 SDK Co-authored-by: JamesNK <303201+JamesNK@users.noreply.github.com> * Refactor into parameterized test using Theory and InlineData Co-authored-by: JamesNK <303201+JamesNK@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: JamesNK <303201+JamesNK@users.noreply.github.com> * Fix * Update pinned SDK version to 10.0.102 (#13936) * Initial plan * Update SDK version from 10.0.101 to 10.0.102 Co-authored-by: danegsta <50252651+danegsta@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: danegsta <50252651+danegsta@users.noreply.github.com> * Apply suggestions from code review * Make Ubuntu runner not identify as WSL2 (#14440) * Try making dotnet not identify github as WSL2, ignore trust error * Skip on error * Remove continue-on-error since workaround was successful * Allow exit code 4 * Add comment explaining workaround --------- Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com> Co-authored-by: JamesNK <303201+JamesNK@users.noreply.github.com> Co-authored-by: danegsta <50252651+danegsta@users.noreply.github.com> Co-authored-by: Jose Perez Rodriguez <joperezr@microsoft.com>
Description
.NET 10.0 SDK changed template version separator from
::to@indotnet new installoutput. The CLI command construction was already updated but the parsing logic wasn't, causingaspire newto fail with "Failed to parse template version from stdout."Example failure:
Changes:
TryParsePackageVersionFromStdoutto parse@separator with::fallback for backward compatibilityinternal(wasprivate) to enable unit testingTheoryandInlineDatacovering new format, old format, and error casesChecklist
<remarks />and<code />elements on your triple slash comments?doc-ideatemplatebreaking-changetemplatediagnostictemplateOriginal prompt
This section details on the original issue you should resolve
<issue_title>aspire new error: Failed to parse template version from stdout.</issue_title>
<issue_description>### Is there an existing issue for this?
Describe the bug