mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-24 09:35:39 -05:00
fixed the issue with resources not disposed correctly (#439)
* fixed the issue with resources not disposed correctly * disposing language service at shutdown
This commit is contained in:
@@ -1119,27 +1119,30 @@ namespace Microsoft.SqlTools.ServiceLayer.Admin
|
||||
throw new ArgumentException("sourceXml");
|
||||
}
|
||||
|
||||
MemoryStream memoryStream = new MemoryStream();
|
||||
StreamWriter streamWriter = new StreamWriter(memoryStream);
|
||||
using (MemoryStream memoryStream = new MemoryStream())
|
||||
{
|
||||
using (StreamWriter streamWriter = new StreamWriter(memoryStream))
|
||||
{
|
||||
// Writes the xml to the memory stream
|
||||
streamWriter.Write(sourceXml);
|
||||
streamWriter.Flush();
|
||||
|
||||
// Writes the xml to the memory stream
|
||||
streamWriter.Write(sourceXml);
|
||||
streamWriter.Flush();
|
||||
// Resets the stream to the beginning
|
||||
memoryStream.Seek(0, SeekOrigin.Begin);
|
||||
|
||||
// Resets the stream to the beginning
|
||||
memoryStream.Seek(0, SeekOrigin.Begin);
|
||||
// Creates the XML reader from the stream
|
||||
// and moves it to the correct node
|
||||
XmlReader xmlReader = XmlReader.Create(memoryStream);
|
||||
xmlReader.MoveToContent();
|
||||
|
||||
// Creates the XML reader from the stream
|
||||
// and moves it to the correct node
|
||||
XmlReader xmlReader = XmlReader.Create(memoryStream);
|
||||
xmlReader.MoveToContent();
|
||||
// generate the xml document
|
||||
XmlDocument xmlDocument = new XmlDocument();
|
||||
xmlDocument.PreserveWhitespace = true;
|
||||
xmlDocument.LoadXml(xmlReader.ReadOuterXml());
|
||||
|
||||
// generate the xml document
|
||||
XmlDocument xmlDocument = new XmlDocument();
|
||||
xmlDocument.PreserveWhitespace = true;
|
||||
xmlDocument.LoadXml(xmlReader.ReadOuterXml());
|
||||
|
||||
return xmlDocument;
|
||||
return xmlDocument;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
Reference in New Issue
Block a user