-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dispose XmlReaders in System.Xml.Xpath.XPathNavigator #103294
Conversation
Tagging subscribers to this area: @dotnet/area-system-xml |
This code creates a number of XmlReader through various method calls. They are not disposed. Since they are IDisposables, the code should dispose them.
a7a68ad
to
619962a
Compare
InsertAfter(reader); | ||
} | ||
|
||
public virtual void InsertAfter(XmlReader newSibling) | ||
{ | ||
ArgumentNullException.ThrowIfNull(newSibling); | ||
|
||
XmlWriter writer = InsertAfter(); | ||
using XmlWriter writer = InsertAfter(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are any of these changes actually improving things? It's possible they could lead to performance regressions, as these are mostly methods that could otherwise be inlined (in particular with dynamic PGO), and now with the exception handling they likely won't be. I'd prefer to close this PR unless it's actually solving a real run-time problem.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are any of these changes actually improving things?
I have no data to make that claim.
I'd prefer to close this PR unless it's actually solving a real run-time problem.
Fair enough!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, thanks
This code creates a number of XmlReader through various method calls. They are not disposed. Since they are IDisposables, the code should dispose them.