I'm developing a server-side application using Fluxor and the project now includes six Actions with a corresponding number of Reducers and Effects. At completion I expect there will be 20+ Actions with associated Reducers and Effects.
Fluxor's state management is working well but as I build out the project I've started getting the following InvalidOperationException randomly:
System.InvalidOperationException
HResult=0x80131509
Message=DisposableCallback with Id "StateSubscriber.Subscribe" was not disposed.
Source=Fluxor
StackTrace:
at Fluxor.DisposableCallback.Finalize()
The Exception isn't raised within my code - it just pops up. The StackTrace doesn't give me a whole lot to go on and I'm a bit stuck with how I should go about diagnosing this issue and correcting it.
When the Exception occurs my application crashes and then, more often than not, immediately displays the Exception again on start-up. A Rebuild All seems to clear it but I suspect there's a Garbage Collection / Memory Management issue going on.
In my code I'm not explicitly disposing of any Fluxor objects and was expecting that would be handled within the Fluxor Framework. However, the "StateSubscriber.Subscribe" makes me wonder if I should be disposing of Fluxor objects. Can someone give me some best practice guidance on that?
I'm using Fluxor 3.1.1 and see 3.2 has just been released. I'll upgrade to that and see if there's any change. In the meantime any ideas about how to diagnose this issue would be appreciated.
FluxorComponent automatically subscribes to state by overriding OnInitialized.
The main culprit of this error is calling the wrong base method when overriding a method, or not calling base when overriding Dispose; for other reasons see: https://github.com/mrpmorris/Fluxor/blob/master/Docs/disposable-callback-not-disposed.md
User contributions licensed under CC BY-SA 3.0