You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note: This is an idea which might be hard to realized, perhaps impossible. Still I think it is good way to think about this problem because it is a clear objective. The solution that comes out of this may be different.
The problem
We need to deal with a lot of IDisposable classes in our code base. There are a lot of issues cause by this. We need to think about it in most of our PRs. If I search for 'SuppressMessage("IDisposableAnalyzers' I get 100 hits. 😬
The proposed solution
Rewrite our code so that the user only needs to dispose the MapControl. Of course many of it's children need to be disposed, but that that is not the users problem. The Map and its children (Layers) should not need dispose.
Is this feasible? What kind of things do we need to dispose right now?
My idea right now is that we have a couple of categories that will always need dispose. Those are:
SkiaSharp object. This is part of the rendering. The Renderer is a field in the MapControl. Those need to be cached and the renderer should be responsible to clear and dispose the cache.
Timers. Those are mostly related to fetching. This could be resolved with a centralized fetcher in the MapControl.
HttpClient and database access. Those are part of the providers. Perhaps we need to register the providers to a registry that is owned by the MapControl (I don't have a clear picture of how that should work. Perhaps a layers only specifies which kind of Provider is used, and the fetcher creates and disposes it.
The text was updated successfully, but these errors were encountered:
Note: This is an idea which might be hard to realized, perhaps impossible. Still I think it is good way to think about this problem because it is a clear objective. The solution that comes out of this may be different.
The problem
We need to deal with a lot of IDisposable classes in our code base. There are a lot of issues cause by this. We need to think about it in most of our PRs. If I search for 'SuppressMessage("IDisposableAnalyzers' I get 100 hits. 😬
The proposed solution
Rewrite our code so that the user only needs to dispose the MapControl. Of course many of it's children need to be disposed, but that that is not the users problem. The Map and its children (Layers) should not need dispose.
Is this feasible? What kind of things do we need to dispose right now?
My idea right now is that we have a couple of categories that will always need dispose. Those are:
The text was updated successfully, but these errors were encountered: