{"action":"created","issue":{"url":"https://api.github.com/repos/dotnet/wcf/issues/51","labels_url":"https://api.github.com/repos/dotnet/wcf/issues/51/labels{/name}","comments_url":"https://api.github.com/repos/dotnet/wcf/issues/51/comments","events_url":"https://api.github.com/repos/dotnet/wcf/issues/51/events","html_url":"https://github.com/dotnet/wcf/issues/51","id":82080613,"number":51,"title":"Confirm correct behaviour in usages of System.Xml.XmlWriter.Dispose()","user":{"login":"iamjasonp","id":1616847,"avatar_url":"https://avatars.githubusercontent.com/u/1616847?v=3","gravatar_id":"","url":"https://api.github.com/users/iamjasonp","html_url":"https://github.com/iamjasonp","followers_url":"https://api.github.com/users/iamjasonp/followers","following_url":"https://api.github.com/users/iamjasonp/following{/other_user}","gists_url":"https://api.github.com/users/iamjasonp/gists{/gist_id}","starred_url":"https://api.github.com/users/iamjasonp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iamjasonp/subscriptions","organizations_url":"https://api.github.com/users/iamjasonp/orgs","repos_url":"https://api.github.com/users/iamjasonp/repos","events_url":"https://api.github.com/users/iamjasonp/events{/privacy}","received_events_url":"https://api.github.com/users/iamjasonp/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/dotnet/wcf/labels/bug","name":"bug","color":"207de5"}],"state":"open","locked":false,"assignee":{"login":"shmao","id":12262109,"avatar_url":"https://avatars.githubusercontent.com/u/12262109?v=3","gravatar_id":"","url":"https://api.github.com/users/shmao","html_url":"https://github.com/shmao","followers_url":"https://api.github.com/users/shmao/followers","following_url":"https://api.github.com/users/shmao/following{/other_user}","gists_url":"https://api.github.com/users/shmao/gists{/gist_id}","starred_url":"https://api.github.com/users/shmao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shmao/subscriptions","organizations_url":"https://api.github.com/users/shmao/orgs","repos_url":"https://api.github.com/users/shmao/repos","events_url":"https://api.github.com/users/shmao/events{/privacy}","received_events_url":"https://api.github.com/users/shmao/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/dotnet/wcf/milestones/10","html_url":"https://github.com/dotnet/wcf/milestones/2016.01","labels_url":"https://api.github.com/repos/dotnet/wcf/milestones/10/labels","id":1450996,"number":10,"title":"2016.01","description":"","creator":{"login":"zhenlan","id":10566826,"avatar_url":"https://avatars.githubusercontent.com/u/10566826?v=3","gravatar_id":"","url":"https://api.github.com/users/zhenlan","html_url":"https://github.com/zhenlan","followers_url":"https://api.github.com/users/zhenlan/followers","following_url":"https://api.github.com/users/zhenlan/following{/other_user}","gists_url":"https://api.github.com/users/zhenlan/gists{/gist_id}","starred_url":"https://api.github.com/users/zhenlan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zhenlan/subscriptions","organizations_url":"https://api.github.com/users/zhenlan/orgs","repos_url":"https://api.github.com/users/zhenlan/repos","events_url":"https://api.github.com/users/zhenlan/events{/privacy}","received_events_url":"https://api.github.com/users/zhenlan/received_events","type":"User","site_admin":false},"open_issues":45,"closed_issues":5,"state":"open","created_at":"2015-12-08T23:30:24Z","updated_at":"2016-01-07T22:04:06Z","due_on":"2016-01-31T08:00:00Z","closed_at":null},"comments":1,"created_at":"2015-05-28T18:55:45Z","updated_at":"2016-01-11T09:21:12Z","closed_at":null,"body":"In all cases within WCF where we use an XmlWriter rather than XmlDictionaryWriter, check that:\r\n* `Dispose()` is called on the XmlWriter after use\r\n* All Xml tags/elements/contents are manually closed and doesn't rely on `Dispose()` to do this work\r\n\r\n\r\n**Background:**\r\nIn desktop .NET, [System.Xml.XmlWriter](http://referencesource.microsoft.com/#System.Xml/System/Xml/Core/XmlWriter.cs) has a virtual `Close()` method that is overridden by, say, [System.Xml.XmlTextWriter](http://referencesource.microsoft.com/#System.Xml/System/Xml/Core/XmlTextWriter.cs) that performs actions like closing all outstanding opened elements. \r\n\r\nIn .NET Core, [System.Xml.XmlWriter](https://github.com/dotnet/corefx/blob/master/src/System.Xml.ReaderWriter/src/System/Xml/Core/XmlWriter.cs) does not expose a `Close()` method anymore, and neither does [System.Xml.XmlTextWriter](https://github.com/dotnet/corefx/blob/master/src/Common/src/System/Xml/XmlTextWriter.cs). You are expected to call the `Dispose()` method instead. \r\n\r\nWe *don't* need to check XmlDictionaryWriter for this issue. `Dispose() == Close()` since [XmlDictionaryWriter](https://github.com/dotnet/corefx/blob/master/src/System.Private.DataContractSerialization/src/System/Xml/XmlDictionaryWriter.cs) (and therefore, derived classes) has a virtual `Close()` method. `XmlDictionaryWriter.Dispose()` will call `XmlDictionaryWriter.Close()`"},"comment":{"url":"https://api.github.com/repos/dotnet/wcf/issues/comments/170480966","html_url":"https://github.com/dotnet/wcf/issues/51#issuecomment-170480966","issue_url":"https://api.github.com/repos/dotnet/wcf/issues/51","id":170480966,"user":{"login":"iamjasonp","id":1616847,"avatar_url":"https://avatars.githubusercontent.com/u/1616847?v=3","gravatar_id":"","url":"https://api.github.com/users/iamjasonp","html_url":"https://github.com/iamjasonp","followers_url":"https://api.github.com/users/iamjasonp/followers","following_url":"https://api.github.com/users/iamjasonp/following{/other_user}","gists_url":"https://api.github.com/users/iamjasonp/gists{/gist_id}","starred_url":"https://api.github.com/users/iamjasonp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iamjasonp/subscriptions","organizations_url":"https://api.github.com/users/iamjasonp/orgs","repos_url":"https://api.github.com/users/iamjasonp/repos","events_url":"https://api.github.com/users/iamjasonp/events{/privacy}","received_events_url":"https://api.github.com/users/iamjasonp/received_events","type":"User","site_admin":false},"created_at":"2016-01-11T09:21:12Z","updated_at":"2016-01-11T09:21:12Z","body":"LGTM, subject to @roncain's comments about indents. \r\n\r\nI also did a quick check and I don't see any new exceptions being thrown from the Dispose code, but might be worth double-checking. "}}