AvaloniaUtils / DialogHost.Avalonia

AvaloniaUI control that provides a simple way to display a dialog with information or prompt the user when information is needed
MIT License
253 stars 16 forks source link

MultiDynamicResourceObservable not getting released when DialogHost is removed #65

Closed MaxwellDAssistek closed 49 minutes ago

MaxwellDAssistek commented 6 days ago

Hello,

I am working on an application that has plugins that contain Avalonia controls. One of those plugins contains a DialogHost.

The problem that I am encountering is that I am unable to get the plugin unloaded because MultiDynamicResourceObservable is holding observables, which causes it to never get garbage collected as shown in dotMemory:

image

Is there a way to get those observables released?

SKProCH commented 6 days ago

Hello. So, is it isn't released even if DialogHost is removed from the window? Or you don't remove the DialogHost, but resource observable holds the resources which should be released since it is unused?

MaxwellDAssistek commented 6 days ago

It isn't released even if the DialogHost is totally removed from the window.

Sep 23, 2024 4:31:06 PM SKProCH @.***>:

This email is from an outside source

Hello. So, is it isn't released even if DialogHost is removed from the window? Or you don't remove the DialogHost, but resource observable holds the resources which should be released since it is unused?

— Reply to this email directly, view it on GitHub[https://github.com/AvaloniaUtils/DialogHost.Avalonia/issues/65#issuecomment-2369318535], or unsubscribe[https://github.com/notifications/unsubscribe-auth/AOUVONXLXVFZUAPXXHVOX43ZYB3AHAVCNFSM6AAAAABOWXZUQ2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNRZGMYTQNJTGU]. You are receiving this because you authored the thread. [Tracking image][https://github.com/notifications/beacon/AOUVONQOOFMICPXW5WIKTDDZYB3AHA5CNFSM6AAAAABOWXZUQ2WGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTUNHDXIO.gif]

SKProCH commented 6 days ago

As a workaround you can set the OverlayBackground and Background properties of DialogHost to some custom values (this prevents creating MultiDynamicResourceObservable). I've also would think about the solution, but since avalonia prohibit creating custom bindings this is isn't easy task.

SKProCH commented 47 minutes ago

Should be fixed with v0.9.0-preview1. If no - please, reopen the issue.