Comments (6)
Okay thanks, this should now be fixed in v3.3.0
Please validate and let me know how it goes.
from easy.messagehub.
This should not be the case. The idea is that MessageHub
will be registered against IMessageHub
in a container and only the class initializing the container or the container itself should be able to dispose the hub otherwise a consumer (publisher or subscriber) could by mistake dispose the hub resulting in other consumers being unable to publish or subscribe.
from easy.messagehub.
When the hub is registered in a Ioc container (DryIoc for instance) as a Singleton, when the container is disposed to clear all registration, the hub is also Disposed which is OK. The problem is that, once the hub is disposed, there is notting else to do to instanciate a new hub instance. The IMessageHub singleton instance is disposed and unusable and since the ctor is private, there is no way to have a working hub again. We need to kill the process. Any solution or fix in mind ?
from easy.messagehub.
Ok, in DryIoc there is a flag you can set to prevent it from calling Dispose on a registration. But I think that having a hub that cannot work anymore and the only solution is to kill the process is a bad thing.. no ?
from easy.messagehub.
That is a valid ask.
My question to you so that I can understand your use-case better is why would you want to dispose the hub and then use it again?
The reasoning behind the current behaviour is that you would only dispose it at the application/process exit, if your intent is to clear existing subscriptions then why not invoke the relevant method?
from easy.messagehub.
Well I agree this is not a common case. What is happening is that we are using it in a Xamarin.Forms application. The actual steps to reproduce my case are the following (for Android only):
- Boostrap the DryIoc container by registering all services when MainActivity (XF apps are typically single activity apps)
- Do stuff...
- Back button is pressed at the root page, the MainActivity is then Destroyed. At this point, we want to Dispose the DryIoc which call Dispose on all IDisposable registration.
- We start the application from the launcher icon again. At this point, and this is the uncommon part (!), the MainActivity is created again and the container is getting boostrapped again. But since we just destroy the MainActivity but did not kill the application, the App was still "alive" and all static content was preserved, thus the MessageHub is disposed and cannot be used anymore.
The main point here is that calling Dispose on the MessageHub make the whole library useless after that point. There is no way of getting the MessageHub up again in the same process.
from easy.messagehub.
Related Issues (20)
- Registering IMessageHub with MessageHub HOT 1
- Subscribing a runtime type HOT 5
- Subscriber is receiving 3 messages when publisher is only sending 1 HOT 7
- Publish & Subscribe from different Project? HOT 2
- Non-singleton instances HOT 8
- Sometimes Unsubscribe method hangs HOT 6
- How to setup one Server with Many cleints between ASP Core web and .net Console service HOT 1
- System.ObjectDisposedException: ThreadLocal object has been deleted. HOT 1
- NuGet package?
- Async handlers HOT 2
- Get MessageHub to play nicely with Autofac in a web application HOT 1
- Conditional subscription HOT 6
- Unflexible detection of the given type HOT 4
- Support for async actions HOT 2
- Support for more profiles? HOT 3
- Available for dotnet core? HOT 2
- Add async version HOT 6
- MessageHub is holding objects in Memory HOT 18
- UnSubscribe method causes ArgumentNullException HOT 1
- Publish and subscribe from different threads HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from easy.messagehub.