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

How do I handle the exception - System.AggregateException A Task's exception(s) were not observed either by Waiting on the Task or accessing its Exception property. As a result, the unobserved exception was rethrown by the finalizer thread. #1928

Open
marafiq opened this issue Apr 16, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@marafiq
Copy link

marafiq commented Apr 16, 2024

Describe the bug

Getting the below exception when sending message to client using Groups.
How do I avoid this or gracefully handle this?
Like below

public static void Notify(long Id, params string[] keys)
  {
      GetHubContext<CountsHub>()
          .Clients
          .Group(GroupKey.FormatWith(Id))
          .notify(GetCounts(Id, default, keys));
  }

Exceptions (if any)

System.InvalidOperationException: No service connection found when sending message
  File "AzureTransport.cs", line 106, in Task AzureTransport.Send(object value)
    throw new InvalidOperationException("No service connection found when sending message");
  File "/_/src/Microsoft.AspNet.SignalR.Core/Hubs/HubDispatcher.cs", line 235, col 21, in Task HubDispatcher.InvokeHubPipeline(IHub hub, IJsonValue[] parameterValues, MethodDescriptor methodDescriptor, HubRequest hubRequest, StateChangeTracker tracker)+(Task<object> task) => { } [1]
  File "/_/src/Microsoft.AspNet.SignalR.Core/TaskAsyncHelper.cs", line 1006, col 17, in TResult TaskAsyncHelper.RunWithPreservedCulture<T1, T2, TResult>(CulturePair preservedCulture, Func<T1, T2, TResult> func, T1 arg1, T2 arg2)
  File "/_/src/Microsoft.AspNet.SignalR.Core/TaskAsyncHelper.cs", line 1017, col 13, in TResult TaskAsyncHelper.RunWithPreservedCulture<T, TResult>(CulturePair preservedCulture, Func<T, TResult> func, T arg)
  File "/_/src/Microsoft.AspNet.SignalR.Core/TaskAsyncHelper.cs", line 1071, col 43, in Task TaskAsyncHelper.ContinueWithPreservedCulture(Task task, Action<Task> continuationAction, TaskContinuationOptions continuationOptions)+(Task<T> t) => { }
  ?, in void ContinuationResultTaskFromResultTask<TAntecedentResult, TResult>.InnerInvoke()
  ?, in void Task.Execute()

Further technical details

  • Your Azure SignalR SDK version - 1.21.4
  • ASP.NET 4.8
  • Your SignalR Client SDK version - 2.4.1
@vicancy
Copy link
Member

vicancy commented May 29, 2024

Need to fix, currently the code throws at

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants