Make ResourceUrlAnnotation.DisplayOrder a non-obsolete property - #20637
Conversation
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 -- 20637Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 20637" |
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Java, Python, and Rust generated snapshots must also be regenerated for the exported DTO property.
Review effort: Balanced
Findings: 1
What changed in this PR
Converts ResourceUrlAnnotation.DisplayOrder from an obsolete field to a public property while preserving URL ordering behavior.
Changes:
- Replaces the field and removes obsolete-warning suppressions.
- Verifies endpoint association preserves display order.
- Updates TypeScript and Go DTO snapshots, but omits Java, Python, and Rust snapshots.
| File | Description |
|---|---|
tests/Aspire.Hosting.Tests/WithUrlsTests.cs |
Tests display-order preservation. |
tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests/Snapshots/TwoPassScanningGeneratedAspire.verified.ts |
Adds the TypeScript property. |
tests/Aspire.Hosting.CodeGeneration.Go.Tests/Snapshots/TwoPassScanningGeneratedAspire.verified.go |
Adds the Go property. |
src/Aspire.Hosting/Orchestrator/ApplicationOrchestrator.cs |
Removes obsolete suppression. |
src/Aspire.Hosting/Dcp/ResourceSnapshotBuilder.cs |
Removes obsolete suppressions. |
src/Aspire.Hosting/Dashboard/DashboardEventHandlers.cs |
Removes obsolete suppression. |
src/Aspire.Hosting/ApplicationModel/ResourceUrlAnnotation.cs |
Converts the field into a property. |
src/Aspire.Hosting.Redis/RedisBuilderExtensions.cs |
Removes obsolete suppression. |
src/Aspire.Hosting.RabbitMQ/RabbitMQBuilderExtensions.cs |
Removes obsolete suppression. |
src/Aspire.Hosting.Qdrant/QdrantBuilderExtensions.cs |
Removes obsolete suppression. |
src/Aspire.Hosting.PostgreSQL/PostgresBuilderExtensions.cs |
Removes obsolete suppression. |
src/Aspire.Hosting.MySql/MySqlBuilderExtensions.cs |
Removes obsolete suppression. |
src/Aspire.Hosting.MongoDB/MongoDBBuilderExtensions.cs |
Removes obsolete suppression. |
src/Aspire.Hosting.Milvus/MilvusBuilderExtensions.cs |
Removes obsolete suppression. |
src/Aspire.Hosting.Kafka/KafkaBuilderExtensions.cs |
Removes obsolete suppression. |
src/Aspire.Hosting.Azure.Functions/DurableTask/DurableTaskResourceExtensions.cs |
Removes obsolete suppression. |
src/Aspire.Hosting.Azure.CosmosDB/AzureCosmosDBExtensions.cs |
Removes obsolete suppression. |
|
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>
Tests selector50 / 97 PR test projects · 4 PR jobs, from 20 changed files. Selected PR test projects (50 / 97)
Selected PR jobs (4)
How these were chosen — grouped by what changed
🔧 show 25
🔧 🔧 🧪 🔧 📦 affected project 🔧 🔧 🔧 🔧 🔧 🔧 🔧 🧪 🧪 🧪 🧪 🧪 Job reasons
Selection computed for commit |
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
Documents changes from microsoft/aspire#20637 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Pull request created: #1806
|
|
📝 Documentation has been drafted in microsoft/aspire.dev#1806 targeting Documented the newly non-obsolete Note This draft PR needs human review before merging. |

Description
ResourceUrlAnnotation.DisplayOrderwas exposed as an obsolete field with a promise to replace it with a property. This change makes it a nullable read/write property and removes the obsolete attribute, so consumers can configure URL ordering without obsolete warnings. Higher values still sort URLs higher in the dashboard.No new dependencies are required.
User-facing usage
For a resource with a
testendpoint:The generated TypeScript DTO now includes
displayOrder?: number | null, and the generated Go DTO includesDisplayOrder *float64.Breaking changes
Replacing a public field with a property is a binary compatibility change for consumers compiled against the old field. Rebuild those consumers against the updated package. Normal C# reads, assignments, and object initializers retain the same syntax; reflection-based consumers must look up a property instead of a field.
Validation
The following commands passed locally on Windows:
.\restore.cmd- passed.dotnet test --project .\tests\Aspire.Hosting.Tests\Aspire.Hosting.Tests.csproj --no-launch-profile -p:SkipNativeBuild=true -- --filter-method '*.WithEndpointPreservesDisplayOrder' --filter-not-trait 'quarantined=true' --filter-not-trait 'outerloop=true'- passed, 4 cases.dotnet test --project .\tests\Aspire.Hosting.CodeGeneration.TypeScript.Tests\Aspire.Hosting.CodeGeneration.TypeScript.Tests.csproj --no-build --no-launch-profile -- --filter-method '*.TwoPassScanning_GeneratesWithEnvironmentOnTestRedisBuilder' --filter-not-trait 'quarantined=true' --filter-not-trait 'outerloop=true'- passed, 1 test after reviewing the regenerated snapshot.dotnet test --project .\tests\Aspire.Hosting.CodeGeneration.Go.Tests\Aspire.Hosting.CodeGeneration.Go.Tests.csproj --no-build --no-launch-profile -- --filter-method '*.TwoPassScanning_GeneratesWithEnvironmentOnTestRedisBuilder' --filter-not-trait 'quarantined=true' --filter-not-trait 'outerloop=true'- passed, 1 test after reviewing the regenerated snapshot.git --no-pager diff --check- passed.The code-generation projects were built by their initial test runs before the
--no-buildverification runs. A full repository build and full test suite were not run.Fixes # (issue)
Checklist
<remarks />and<code />elements on your triple slash comments?