dsuryd/dotNetify

ObjectDisposedException in AppBuilderExtensions

OracPrime opened this issue · 3 comments

There is a catch clause in AppBuilderExtensions.cs:

            catch (ObjectDisposedException)
            {
               // There's a chance the scoped service provider is already disposed when we get to here, so fall back to global provider.
               return ActivatorUtilities.CreateInstance(provider, type, args ?? new object[] { });
            }

This seems to be happening all the time for me - which clearly I can ignore, but I wonder if it is a symptom of something else. In particular it seems to go off when a Reactive property Subscribe target is called. The property is set up in the constructor

AddProperty<IReadOnlyCollection<long>>("CpuHistory", Array.Empty<long>()).SubscribeTo(cluster.CpuHistoryStream).Subscribe(_ => PushUpdates());

And within the PushUpdates the error occurs.
Am I doing something wrong, or is this an area where the code needs to be improved, or is it a "live with it" scenario?

Thanks.

The exception typically happens when the view is closed on the client while the server is in the process of pushing updates. Does this describe your situation? In any case, it's indeed an area where the code can be improved.

No - I don't believe I have any view closures. This is one browser, one app, clean start to stable.

Fixed in v5.0.