Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CreationCollisionOption.ReplaceExisting is treated as CreationCollisionOption.OpenIfExists #1067

Closed
zipswich opened this issue Jun 13, 2019 · 0 comments · Fixed by #3353
Closed
Assignees
Labels
kind/bug Something isn't working platform/ios 🍎 Categorizes an issue or PR as relevant to the iOS platform

Comments

@zipswich
Copy link

zipswich commented Jun 13, 2019

 //The following code shows CreationCollisionOption.ReplaceExisting is treated as CreationCollisionOption.OpenIfExists
            StorageFile sfFoo = await ApplicationData.Current.LocalFolder.CreateFileAsync("foo", CreationCollisionOption.ReplaceExisting);
            using (StreamWriter dr = new StreamWriter(await sfFoo.OpenStreamForWriteAsync()))
            {
                await dr.WriteAsync("this is foo + foo");
                await dr.FlushAsync();
                dr.Close(); //Supposed to be redundant
            }
            StorageFile sfFoo2 = await ApplicationData.Current.LocalFolder.CreateFileAsync("foo", CreationCollisionOption.ReplaceExisting);
            using (StreamWriter dr = new StreamWriter(await sfFoo.OpenStreamForWriteAsync()))
            {
                await dr.WriteAsync("this is abc");
                await dr.FlushAsync();
                dr.Close(); //Supposed to be redundant
            }

            StorageFile sfFooRead = await ApplicationData.Current.LocalFolder.GetFileAsync("foo");
            using (FileStream stream = File.OpenRead(sfFooRead.Path))
            using (StreamReader sr = new StreamReader(stream))
            {
                {
                    //The following outputs: "this is abc + foo"
                    //It is supposed to be: "this is abc"
                    Console.WriteLine(sr.ReadToEnd());
                }
            }

Environment

  • OS: iOS
  • Version 12
  • Device: Simulator

Repro:
https://github.com/zipswich/UnoDebug

@ghuntley ghuntley added platform/ios 🍎 Categorizes an issue or PR as relevant to the iOS platform kind/bug Something isn't working labels Jun 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working platform/ios 🍎 Categorizes an issue or PR as relevant to the iOS platform
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants