question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unobserved exception

See original GitHub issue

Broker: Mosquitto v1.4.14 MQTTnet: v2.6.0

Both the connection and server are stable but exceptions like these happen alot.


 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. ---> MQTTnet.Exceptions.MqttCommunicationTimedOutException: Exception of type 'MQTTnet.Exceptions.MqttCommunicationTimedOutException' was thrown.

   at MQTTnet.Internal.TaskExtensions.<TimeoutAfter>d__1`1.MoveNext()

--- End of stack trace from previous location where exception was thrown ---

   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)

   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

   at MQTTnet.Client.MqttPacketDispatcher.<WaitForPacketAsync>d__4.MoveNext()

   --- End of inner exception stack trace ---

   at System.Threading.Tasks.TaskExceptionHolder.Finalize()

---> (Inner Exception #0) MQTTnet.Exceptions.MqttCommunicationTimedOutException: Exception of type 'MQTTnet.Exceptions.MqttCommunicationTimedOutException' was thrown.

   at MQTTnet.Internal.TaskExtensions.<TimeoutAfter>d__1`1.MoveNext()

--- End of stack trace from previous location where exception was thrown ---

   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)

   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

   at MQTTnet.Client.MqttPacketDispatcher.<WaitForPacketAsync>d__4.MoveNext()<---

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:22 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
JanEggerscommented, Jan 25, 2018

nope you can publish an array of Messages, or if you simply whant to fire and forget you can wrap publish with an async void method that handles the exception. but thats not good practise

0reactions
GieltjEcommented, Jun 5, 2018

Probably fixed with the latests commits in development, thanks for the effort.

Read more comments on GitHub >

github_iconTop Results From Across the Web

TaskScheduler.UnobservedTaskException Event
Occurs when a faulted task's unobserved exception is about to trigger exception escalation policy, which, by default, would terminate the process.
Read more >
TaskScheduler.UnobservedTaskException event handler ...
The UnobservedTaskException will only happen if a Task gets collected by the GC with an exception unobserved - as long as you hold...
Read more >
Async Wandering Part 7 — Exceptions on unobserved tasks
It doesn't print any exception because we don't await the task. Can we do something about it? Let's use the UnobservedTaskException handler:.
Read more >
Unobserved task exception · Issue #29067 · dotnet/runtime
It seems like an exception is bubbling up through your code, and whatever code is using yours is in a task that catches...
Read more >
Curious Case of Exceptions in Async Methods — Part 2
Unobserved Task Exception : A Task's exception(s) were not observed either by Waiting on the Task or accessing its Exception property.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found