Bug 25132 - SafeHandle always called with Disposed(true)
Summary: SafeHandle always called with Disposed(true)
Alias: None
Product: Class Libraries
Classification: Mono
Component: mscorlib ()
Version: unspecified
Hardware: PC Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Marek Safar
Depends on:
Reported: 2014-12-06 19:50 UTC by Marius Ungureanu
Modified: 2014-12-08 11:51 UTC (History)
2 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Marius Ungureanu 2014-12-06 19:50:49 UTC
In [1] we're trying to add some leaks handling in LibGit2Sharp. Based on debugging, I noticed that SafeHandle.Dispose(bool) is always called with true, so code at [2] is not gathering any leaks, whilst it does on .NET. Compare [3] and [4].

Probably as easy as importing reference source?

[1] - https://github.com/libgit2/libgit2sharp/pull/883
[2] - https://github.com/libgit2/libgit2sharp/blob/ntk/leaks/LibGit2Sharp/Core/Handles/SafeHandleBase.cs#L93-L102
[3] - https://ci.appveyor.com/project/nulltoken/libgit2sharp/build/108/job/0hywvy5jgksvsxtt
[4] - https://travis-ci.org/libgit2/libgit2sharp/jobs/43222585
Comment 1 Marek Safar 2014-12-08 04:17:25 UTC
I'd need some help to track down what is the source of the issue.

Firstly. SafeHandle.Dispose(true) only means that the handle is disposed manually (which is good) and not via GC.

The link at [2] is not working for me and some sort of repro (small if possible) would be helpful.
Comment 2 Marius Ungureanu 2014-12-08 09:09:05 UTC
This is the code, sorry. The PR got merged.

Comment 3 Marius Ungureanu 2014-12-08 09:47:05 UTC
I've set up a test repository to show this bug. MS.NET throws an exception, Mono does not.

Comment 4 Marek Safar 2014-12-08 11:51:53 UTC
Fixed in master