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 8551203
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T14:08:44+00:00 2026-06-11T14:08:44+00:00

I have a timer function that serialize an object into a xml file once

  • 0

I have a timer function that serialize an object into a xml file once every minute. It works for awhile but after about 38 hours or so it has the IO exception below.enter image description here

I can see the directory is there as you can see in my screenshot. Also when this issue occurs I can even type the following command in dos: echo “test” > test.xml and I could create the test.xml file at that exact directory location.

My code is as follow:

try
  {
    if (!Directory.Exists(filePath))
      this.log.Write(LogLevel.Fatal, this.componentName, "Directory not exists: " + filePath);


     lock (lockObject)
        {
          filepath = filepath + "ApplicationState.xml";
          if (File.Exists(filePath))
             File.Delete(filePath);

          if (this.StateObject != null && !File.Exists(filePath))
          {
             using (Stream sWrite = File.Create(filePath))
             {
                this.Serializer = new XmlSerializer(typeof(State));
                this.Serializer.Serialize(sWrite, this.StateObject);
             }
           }
        }
     }catch (Exception ex)
     {
        if (this.log != null)
        {
           this.log.Write(ex, this.componentName);
        }
     }
     finally
     {
        if (this.StreamWriter != null)
        {
             this.StreamWriter.Close();
        }
        bRun = true;

      }

I tried by best to go over the code to make sure that don’t have any hanging IO resources and at this point I am at quite a lost to be honest… does window CE or C# has some type of lock resource on the general IO other than the one I use to open and read file?

  • 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-06-11T14:08:45+00:00Added an answer on June 11, 2026 at 2:08 pm

    I see that you’re writing to something called “\Hard Disk” which makes me think you’re likely writing to some persistent storage volume (e.g. on-board flash, a USB disk, CF card or whatever). Bear in mind that these peripherals require a device driver and likely some interrrupt handlers, which are provided by the device OEM and not Microsoft as part of the OS.

    There’s always the possibility that there’s a bug in the driver chain somewhere that’s causing the issue – it smells like a concurrency lock failure. Remember, when working with an embedded OS, never assume a failure you see is always your code. The OEM could easily have a bug in their code.

    I’d attack this two ways:

    1. Report the issue to the OEM and see if they can repro/fix it
    2. Try to add retry logic to your own code to look for and handle this issue as a workaround.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a large 2d array that I serialize and base64_encode and throw into
So I have a large 2d array that i serialize, but when I attempt
Have a form that is not being read by serialize() function. <script type=text/javascript> function
I have a codeigniter application.In that i call the controller function using ajax/jquery.But when
I have a function that creates time intervals between two time marks. The function
I have a function that counts how many times a words appears on a
I have a function that convert ticks to time_t format long ticks = DateTime.Now.Ticks;
I have a function that needs to call a virtual method many times in
I have a function that's called hundreds of thousands of times per update, and
I have a function that I have used a bunch of times in various

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.