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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T23:16:36+00:00 2026-06-11T23:16:36+00:00

I get an error when I open the file after it is created using

  • 0

I get an error when I open the file after it is created

using (var myFileStore = IsolatedStorageFile.GetUserStoreForApplication())
        {
            myFileStore.CreateFile(DateTime.Now.Ticks + ".txt");
        }
using (var myFileStore = IsolatedStorageFile.GetUserStoreForApplication())
        {
            temp = myFileStore.GetFileNames();
            for (int k = 0; k < temp.Length; k++)
            {
                IsolatedStorageFileStream file1 = myFileStore.OpenFile(temp[k], FileMode.Open, FileAccess.Read);
                dataSource.Add(new SampleData() { Name = temp[k], Size = Convert.ToString(Math.Round(Convert.ToDouble(file1.Length) / 1024 / 1024, 1) + " MB") });
            }
        }
  • 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-11T23:16:38+00:00Added an answer on June 11, 2026 at 11:16 pm

    That is due to the fact you didn’t close the stream returned by the CreateFile method!

    Your code should look like this:

    using (var myFileStore = IsolatedStorageFile.GetUserStoreForApplication())
    {
        myFileStore.CreateFile(DateTime.Now.Ticks + ".txt").Dispose();
    }
    

    or

    using (var myFileStore = IsolatedStorageFile.GetUserStoreForApplication())
    {
        using(myFileStore.CreateFile(DateTime.Now.Ticks + ".txt"))
        {
        }
    }
    

    And the same in the OpenFile below.

    Bottom line you should always dispose your stream (by using the using clause or Dispose() method)

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

Sidebar

Related Questions

When I attempt to open a file to write, I get an error: Ada.IO_Exceptions.Name_Error
I get this error ([Errno 2] No such file or directory) after I push
i get this error Cannot open database DataLayer.Context.MedicallexiconContext requested by the login. The login
I get the error Data Source cannot be empty. Use :memory: to open an
When I debug my app i get this error from MonoDevelop Could not open
When I try to open a project's CodeAnalysis page I get the error An
Whenever I try to open .pyc or .pyo files, I always get an error
I get the following error coming from my Linq query: ExecuteReader requires an open
Problem Description: Occassionally when debugging, I get the following error. I'm using visual studio
I am creating dynamically a PDF file. After creating I want to open the

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.