Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6880089
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T04:55:47+00:00 2026-05-27T04:55:47+00:00

I develop a simple app, when i try to save an XMLDocument to a

  • 0

I develop a simple app, when i try to save an XMLDocument to a thumb drive which doesn’t have enough free space, weird thing happens. Though i already added “try catch” clause for XMLDocument.Save(filePath), i still get an unhandled exception, and the exception seems to be thrown from GC finalization thread (seems GC tries to flush another 4096 bytes which the disk does not have). I think it is a common scenario to use XMLDocument object , i wonder what is wrong?

code snippet:

XmlDocument query = new XmlDocument();
query.Load("g:\\test.xml");
... //modify the content of query to make it bigger
try
{
  query.Save("g:\\test.xml");
}
catch(Exception ex)
{}

Exception stacktrace as below:

mscorlib.dll!System.IO.__Error.WinIOError(int errorCode = 112, string maybeFullPath = “”) + 0x498 bytes
mscorlib.dll!System.IO.FileStream.WriteCore(byte[] buffer, int offset, int count) + 0x119 bytes
mscorlib.dll!System.IO.FileStream.FlushWrite(bool calledFromFinalizer) + 0x22 bytes
mscorlib.dll!System.IO.FileStream.Dispose(bool disposing = false) + 0x57 bytes
mscorlib.dll!System.IO.FileStream.Finalize() + 0x1b bytes

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T04:55:47+00:00Added an answer on May 27, 2026 at 4:55 am

    Well, the problem is that some code somewhere isn’t disposing of the FileStream when it’s done with it. When the FileStream is finalized, it’s trying to flush the data – at which point the exception is being thrown.

    If that really is all of your code, it sounds like it’s a bug in XmlDocument.Save(), which should definitely close all its streams before returning. You could work around this by opening the FileStream yourself (with a using statement) and passing the stream to XmlDocument.Save instead.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have some WinForms app (Framework to develop some simple apps), written in C#.
i have some WinForms app (Framework to develop some simple apps), written in C#.
I'm learning to develop apps using Qt Creator. I have built a simple app
I'm trying to develop a simple WP7 database app which uses Linq2SQL to query
I'm looking to develop/obtain a simple GMaps app for my site that lets the
My i have to develop simple window based iphone application. In my first screen
I want to develop a simple orm which performs CRUD functionality.Shold i use reflection?
I'm using seam to develop a simple web app. Using a4j commandButton in many
I am a beginner ios developer.I am tryin to develop a simple jokes app.Is
I'm stuck with a seemingly very simple app that I'm trying to develop Basically,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.