RemoteHost: remove unnecessary try/finally in JsonRpcServer.StartAsync
Maintainers usually reply within 2 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 1/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 92/100
Research direction
Read src/Aspire.Hosting.RemoteHost/JsonRpcServer.cs and simplify StartAsync as described in the issue. Then run the existing Listening tests in tests/Aspire.Hosting.RemoteHost.Tests/JsonRpcAuthenticationTests.cs; done when they pass and startup behavior is unchanged.
Written by the indexing model from the issue text.
Description
Follow-up from #21531 (review by @sebastienros: https://github.com/microsoft/aspire/pull/21531#discussion_r4463017255).
JsonRpcServer.StartAsync in src/Aspire.Hosting.RemoteHost/JsonRpcServer.cs wraps base.StartAsync in a try/finally so that ObserveExecuteTask() always runs. That failure path doesn't exist: the project targets net10.0, where BackgroundService.StartAsync schedules ExecuteAsync with Task.Run and always returns Task.CompletedTask. Even if it did throw, ExecuteTask would still be null and ObserveExecuteTask would do nothing.
Simplify to:
public override async Task StartAsync(CancellationToken cancellationToken)
{
await base.StartAsync(cancellationToken).ConfigureAwait(false);
ObserveExecuteTask();
}
This is a readability cleanup with no behavior change. The existing Listening tests in tests/Aspire.Hosting.RemoteHost.Tests/JsonRpcAuthenticationTests.cs cover the startup, failure and cancellation paths.
🤖 Posted by AspireAgent (AI Agent)
- Dominant language
- C#
- Stars
- 6.4k
- Forks
- 1k
- Avg merge
- 3d 3h
- Merged PRs (30d)
- 349
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from microsoft/aspire
-
Aspire.Hosting.Yarp flattens TimeSpan cluster settings (ActivityTimeout, health-check intervals) into per-property env vars the YARP container ignoresPossibly taken @itsrayeedscodespace claimed this 1 day ago. Openarea-integrations
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 2 days
-
Dashboard structured logs toolbar overlaps the resource name and wraps poorly in constrained layoutsOpenarea-dashboard
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 2 days
-
area-dashboard
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Maintainers usually reply within 2 days
-
area-dashboard
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Maintainers usually reply within 2 days
-
area-templates
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
Maintainers usually reply within 2 days
All issues in microsoft/aspire
Similar issues
-
Assert.That on a null non-generic IEnumerable throws ArgumentNullException, so IsNull() cannot passOpenbug P2
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
area/automation area/sdk kind/bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
unoplatform/uno.templates#2406 ·
Maintainers usually reply within 1 day
-
bug frontend ui
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
agentic-workflows
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
documentation trivial
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day