locked
It's urgent Please help: Nothing is being written to csv file windows store app c# [Tough one]

    Question

  • I'm using the following code to write to a .csv file.

                StorageFolder storageFolder = Windows.Storage.ApplicationData.Current.LocalFolder;
                StorageFile newFile = await storageFolder.CreateFileAsync("myFile.csv", CreationCollisionOption.ReplaceExisting);
                tb.Text = storageFolder.Path;
    
                String z = null;// content to be written
                z += ("Hi" + " > " + "THAT");
                z += (",Testing\n");
    
                await Windows.Storage.FileIO.WriteTextAsync(newFile, z);

    This code works perfectly for me (I open the file using Microsoft Office). But when one of my friend (who is French) uses the same app, the file is created with 

    ÐÏࡱá ;  þÿ     þÿÿÿ 
    þÿÿÿ ÿÿÿÿÿÿÿ

    ,  app crashes, and OPEN OFFICE cannot open that file.

    The error shown by Open office:

    The myFile.csv file is corrupt and can't be opened. OpenOffice can try to repair the file. The corruption may be the resulta of a manipulation of the document or of a deterioration of the structrue of the document due to the transmission of data. We recommende not to trust the content of the repaired document. The macro execution is unactivated. Should OpenOffice repair the file? Yes No

    If you want to look at the app (optional), here is the link: http://apps.microsoft.com/windows/en-us/app/0ba7a9df-59dd-4410-9ecb-67eac3e81b63. Click on export button on the bottom at bar after selecting some options, and file will be exported.




    Wednesday, October 22, 2014 5:15 PM

All replies

  • When you debugged this where did it fail?

    Did z get set appropriately?

    If you run ProcMon while saving out do you see any errors?

    Does the app crash or close before the file is written and flushed?

    Do you get the same behavior with the File access sample?

    Are you and your friend running in the same locale? Do you reproduce the problem if you switch yours to match his?

    See Quickstart: Reading and writing files

    If you'd like us to look at your app please share on your OneDrive a minimal sample which demonstrates the problem.

    Wednesday, October 22, 2014 5:57 PM
    Owner
  • Works perfectly for me, it doesn't fail or crash. But my friend sitting in another country sees a blank screen and app become unresponsive when he exports.
    Wednesday, October 22, 2014 6:01 PM
  • If you need help with this please answer the other questions I asked. If you'd like us to look at your code then please provide a minimal sample project on your OneDrive. Just running your app without context or code isn't helpful. Also, if you are going to claim the app meets accessibility standards you should test it for accessibility. It does not work correctly either with high contrast modes (there are many hard-coded colours) or with Narrator (the score should be a live region, the VS image reads as "Image" and the app-bar buttons read as "Button").

    You also edited the original post to change the symptoms. Is the bad file zero length or does it have garbage characters in it? It should be a text file, so Notepad will be a better way to examine the contents than OpenOffice.

    Additional questions for the new symptoms: can you open the bad file on your system? can your friend open your good file on his system?

    --Rob

    Wednesday, October 22, 2014 7:06 PM
    Owner
  • Yeah I'm sorry, the file contains garbage characters.

    The problem is that file is not being created properly in his computer. He sees nothing when he opens it in wordpad.
    Wednesday, October 22, 2014 7:24 PM
  • If you still need help with this please answer the other questions I asked. If you'd like us to look at your code then please provide a minimal sample project on your OneDrive.

    Friday, November 21, 2014 1:26 AM
    Owner