I am trying to save XDcoument to a flash drive that does not have enough memory. (This is a special test condition for the application) Although the application provides an exception, as shown below, I cannot get this in the try catch block around XDocument.Save (filePath). This looks like a delayed throw. Is this a LINQ problem or am I doing something wrong?
alt text http://img211.imageshack.us/img211/8324/exce.png
System.IO.IOException was unhandled Message="There is not enough space on the disk.\r\n" Source="mscorlib" StackTrace: at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.FileStream.WriteCore(Byte[] buffer, Int32 offset, Int32 count) at System.IO.FileStream.FlushWrite(Boolean calledFromFinalizer) at System.IO.FileStream.Dispose(Boolean disposing) at System.IO.FileStream.Finalize()
. XDocument.Save(string) "using", , . , , System.Xml.XmlUtf8RawTextReader .
: Microsoft, , Dispose(). Close().
, connect.microsoft.com. , , . , . , , , .
, XDocument.Save(TextWriter), StreamWriter, XML.
. Finalize, Dispose, FlushWrite, WriteCore, .
, .
, , , .
,
using (XmlWriter writer = XmlWriter.Create(fileName, xmlWriterSettings)) { this.Save(writer); }
, ., Save.
Save
: Dispose d , XDocument, Save?
Dispose
XDocument.Save(string) , Dispose. using: - ( )
XDocument.Save(string)
via (XmlWriter writer = XmlWriter.Create(fileName, xmlWriterSettings)) this.Save(writer);
(XmlWriter writer = XmlWriter.Create(fileName, xmlWriterSettings)) this.Save(writer);
And XmlWriter has Dispose(), it implements the interface IDisposable.
Dispose()
IDisposable
Source: https://habr.com/ru/post/1728357/More articles:Are there any helpful videos about Core Data? - iphoneJava program with startupparameters parameters in eclipse - javaOpening URL at startup - cocoaByte.decode ("10") and Byte.valueOf ("10") - what's the difference? - javagzip HttpWebRequest - c #How can I prevent the LinqDataSource Where clause from being reset after returning? - asp.netJQuery rotating banner - javascriptHow to force a full return from code? - ajaxHow do servlets work? - javaWhere can I find the "delegate" and "datasource" documentation for an NSTableView? - cocoaAll Articles