Skip to content
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

Fix DashboardClient flaky test #2608

Merged
merged 3 commits into from
Mar 4, 2024
Merged

Conversation

JamesNK
Copy link
Member

@JamesNK JamesNK commented Mar 4, 2024

Dispose could happen after we've check for dispose but before getting the token from the CTS.

Fix by taking a copy of the token when the CTS is created.

Test error:

System.ObjectDisposedException : The CancellationTokenSource has been disposed.
Stack trace
at System.Threading.CancellationTokenSource.get_Token() at Aspire.Dashboard.Model.DashboardClient.b__23_0() in //src/Aspire.Dashboard/Model/DashboardClient.cs:line 145 at System.Threading.Tasks.Task`1.InnerInvoke() at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) --- End of stack trace from previous location --- at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) --- End of stack trace from previous location --- at Aspire.Dashboard.Utils.TaskHelpers.WaitIgnoreCancelCoreAsync(Task task, ILogger logger, String logMessage) in //src/Shared/TaskHelpers.cs:line 29 at Aspire.Dashboard.Model.DashboardClient.DisposeAsync() in //src/Aspire.Dashboard/Model/DashboardClient.cs:line 389 at Aspire.Dashboard.Tests.Model.DashboardClientTests.SubscribeResources_OnDispose_ChannelRemoved() in //tests/Aspire.Dashboard.Tests/Model/DashboardClientTests.cs:line 69 --- End of stack trace from previous location ---

Microsoft Reviewers: Open in CodeFlow

@JamesNK JamesNK changed the title Jamesnk/dashboardclient flakytest Fix DashboardClient flaky test Mar 4, 2024
@davidfowl davidfowl merged commit 5d30d3a into main Mar 4, 2024
8 checks passed
@davidfowl davidfowl deleted the jamesnk/dashboardclient-flakytest branch March 4, 2024 14:02
@github-actions github-actions bot locked and limited conversation to collaborators Apr 20, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants