Mango
Mango
CC#
Created by Mango on 6/14/2023 in #help
✅ 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
26 replies
CC#
Created by Mango on 6/13/2023 in #help
socket message queue questions
As I impl my own MQ, taking in everyone who has showed me example and such, I notice Channel<T> doesn't have a subscribe system like I thought it would (example from Akari used them). You have to constantly read on the Reader. I add a serialized packet to a collection to be handled for further processing to properly sort it. I think from research what I want is an ObservableCollection ?
3 replies
CC#
Created by Mango on 6/12/2023 in #help
✅ generic mess
If I have a type that takes <T, E> is there a way to return T generically I.E.
private async Task<Result<T, string>> Get<T>(T type)
private async Task<Result<T, string>> Get<T>(T type)
Where T is a type I pass in
13 replies