Overuse of NotClientImplementable attribute #17591
AlexeyTliss
started this conversation in
General
Replies: 2 comments 6 replies
-
I honestly think it's better to try fixing the underlying issue and provide a PR this would also create packages in the all feed for you. |
Beta Was this translation helpful? Give feedback.
5 replies
-
@maxkatz6 Why is Edit: Maybe its the API isn't considered final? For things like Delete and Move I would normally expect those to be in a different class rather than the reference to the storage item itself. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Currently we had three instances where
NotClientImplementable
was a stumbling stone for us, which caused a lot of extra work where we could avoid it:We needed custom
IClassicDesktopStyleApplicationLifetime
andISingleViewApplicationLifetime
implementation for Headless tests, since app heavily relies on certain lifetime functions. In the end, we had to use hackish workaround by instancing DesktopLifetime via lambda-compile activator and set Avalonia's builder private _lifeTime field value to this instance every time app is instanced, otherwise Headless tests just won't workWhen we discovered a memory leak in ContentControl (it won't let go of bindings which refer to static content or singleton viewmodels) we tried to to make it's ancestor or implpement
IContentPresenterHost
ourselves only to find out we can't do it because ofNotClientImplementable
(this was in 11.0, things may be different in 11.2), in the end, we had to use hacksNow, we found out that
StorageProvider.OpenFilePickerAsync
causes either access denied (if use dbus) or segfault (if use gtk) on one of our target platforms - Astra Linux. To our suprise, legacy OpenFileDialog works just fine! So, since we needIStorageItem
api for most of other platfroms like Android, IOS and Browser, the solution was simple: call OpenFilePickerAsync through a wrapper which call eitherStorageProvider.OpenFilePickerAsync
on platform where this works, or calls OpenFilePickerAsync.ShowAsync() and then returns our own implementation ofIStorageItem
which take file path in consturctor and just use basica OS functions like File.Create, easy! Well, except IStorageItem isNotClientImplementable
so now we have to use ugly workarounds like these https://pastebin.com/Z85kpU9LThere also people who had issues with
NotClientImplementable
similar to ours:#17267
#17275
Please, please reconsider the overuse of this attribute. If user wants to implement an unstable api which may broke on any update - let it be their own problem. Don't be a code police with a baton
Beta Was this translation helpful? Give feedback.
All reactions