© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
25 replies
Mango

✅ Implementing IDisposable properly

I have a class I implemented IDisposable in which subscribes to an observable of a type. Example: subscribes to an incoming GenericMessage. I am running into an issue where when an instance of this class should be disposed, it's still alive intercepting data from another class that needs it. Here are my logs for visualization:
[SetResult] Fired for MessageReceiver`1[Messages.GenericMessage]
...
[Dispose] Fired for MessageReceiver`1[Messages.GenericMessage]
...
[SetResult] Fired for MessageReceiver`1[Messages.GenericMessage]
[Fatal] An attempt was made to transition a task to a final state when it had already completed
[SetResult] Fired for MessageReceiver`1[Messages.GenericMessage]
...
[Dispose] Fired for MessageReceiver`1[Messages.GenericMessage]
...
[SetResult] Fired for MessageReceiver`1[Messages.GenericMessage]
[Fatal] An attempt was made to transition a task to a final state when it had already completed

As you see my dispose is called but it's still alive. I am using the dispose design pattern as outlined in the IDisposable docs
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Tailwind CSS not implementing properly
C#CC# / help
2y ago
❔ For loop not implementing properly
C#CC# / help
3y ago
IDisposable Constructor Injection
C#CC# / help
12mo ago
IDisposable ownership semantics
C#CC# / help
15mo ago