Ensure proper IDisposable implementation
I think a few things are missing to play nice with the GC long term. Very enclined to use https://github.com/Fody/Janitor
Thoughts?
Activity
-
Newest first Oldest first
-
Show all activity Show comments only Show history only
- Developer
I'm not really fond of magic implementations with Fody. I'd prefer something like IDisposableAnalysers, which checks if everything is properly disposed.
- Author Maintainer
I'm not really fond of magic implementations with Fody.
It's not magic if you understand what it's doing :-P which is pretty well documented IMO. But I get what you mean.
I'd prefer something like IDisposableAnalysers
Sure, but that goes hand in hand with a manual approach (opposite to Fody).
I'll have a look at both Fody.Janitor and also at how much dispose logic can be shared if we go without.
- Developer
Can you ensure proper usage of IDisposable in your code with Fody? like File.Open, can you ensure that it is properly closed?
- Author Maintainer
A user calling Dispose on an instance which has a file open is not cool :-P
Have a look at the README, but yes, Fody.Janitor provides
- thread safe IDisposable implementation (inspired from https://blogs.msdn.microsoft.com/blambert/2009/07/24/a-simple-and-totally-thread-safe-implementation-of-idisposable/ I guess).
- Custom managed handling
- Custom unmanaged handling
- Combination of the above scenarios
- Arbitrary disabling it with [Janitor.SkipWeaving]
The way I see it,
Internal
would perform the standardrelease
P/Invoke call. But before that, concrete classes would do their own cleanup (forLibVLC
, that'd mean for example (if necessary) closing file logs, unregistering exit/dialog handlers, etc). That applies with or without fody. - Owner
I'm not too fan of Fody either.
- Author Maintainer
Hi @Dresel,
Was not aware of that bug, but it will be fixed in https://github.com/videolan/libvlcsharp/pull/18.
Regarding the Microsoft guidelines for IDisposable libvlc object, I'm aware it needs some work and it is being tracked by this issue.
- Martin Finkel mentioned in commit mfkl/LibVLCSharp@cc0619de
mentioned in commit mfkl/LibVLCSharp@cc0619de
- Martin Finkel mentioned in merge request !2 (merged)
mentioned in merge request !2 (merged)
- Martin Finkel closed via merge request !2 (merged)
closed via merge request !2 (merged)
- Martin Finkel closed via commit cc0619de
closed via commit cc0619de
- Martin Finkel mentioned in commit 9b304411
mentioned in commit 9b304411