{"action":"opened","issue":{"url":"https://api.github.com/repos/BADF00D/DisposableFixer/issues/16","repository_url":"https://api.github.com/repos/BADF00D/DisposableFixer","labels_url":"https://api.github.com/repos/BADF00D/DisposableFixer/issues/16/labels{/name}","comments_url":"https://api.github.com/repos/BADF00D/DisposableFixer/issues/16/comments","events_url":"https://api.github.com/repos/BADF00D/DisposableFixer/issues/16/events","html_url":"https://github.com/BADF00D/DisposableFixer/issues/16","id":195622360,"number":16,"title":"Certain types that track disposables and therefore these disposable should be ignored","user":{"login":"BADF00D","id":2852160,"avatar_url":"https://avatars.githubusercontent.com/u/2852160?v=3","gravatar_id":"","url":"https://api.github.com/users/BADF00D","html_url":"https://github.com/BADF00D","followers_url":"https://api.github.com/users/BADF00D/followers","following_url":"https://api.github.com/users/BADF00D/following{/other_user}","gists_url":"https://api.github.com/users/BADF00D/gists{/gist_id}","starred_url":"https://api.github.com/users/BADF00D/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BADF00D/subscriptions","organizations_url":"https://api.github.com/users/BADF00D/orgs","repos_url":"https://api.github.com/users/BADF00D/repos","events_url":"https://api.github.com/users/BADF00D/events{/privacy}","received_events_url":"https://api.github.com/users/BADF00D/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-12-14T19:25:58Z","updated_at":"2016-12-14T19:25:58Z","closed_at":null,"body":"There are certain types that track instances of IDisposables themself. If these instances are disposed, they automatically dispose the instance they keep track of.\r\nE.g the following code should not yield an diagnostics, because StreamReader disposed the given MemoryStream:\r\n\r\n```csharp\r\nusing System.IO;\r\n\r\nnamespace DisFixerTest.Tracking {\r\n    internal class Tracking {\r\n        public static void Do() {\r\n            var mem = new MemoryStream();\r\n\r\n            using (var tracking = new StreamReader(mem)) { }\r\n        }\r\n    }\r\n}\r\n```\r\n\r\nOn the other hand, in the folling code ```mem``` should be marked as not disposed.\r\n```csharp\r\nusing System;\r\nusing System.IO;\r\n\r\nnamespace DisFixerTest.Tracking {\r\n    class NoneTracking : IDisposable {\r\n        public static void Do() {\r\n            var mem = new MemoryStream();\r\n\r\n            using(var tracking = new NoneTracking(mem)) { }\r\n        }\r\n\r\n        public NoneTracking(IDisposable disp) {}\r\n\r\n        public void Dispose() {\r\n            throw new NotImplementedException();\r\n        }\r\n    }\r\n}\r\n```\r\n\r\n"}}
{"actor":{"display_login":"BADF00D"}}