Reading from a File (async) doesn't initialize the app in time RRS feed

  • Question

  • My app reads some data from a couple files at startup. The data is then stored into containers. During the startup process, if the containers are present, it reads from the containers instead of the files.

    The first time I run the app, not all of the data does not appear in the app.  However, subsequent times, the app runs just fine (when reading from the containers).

    I'm guessing this has to do with the async nature of file IO.  Is there a way to read the data non-async or to be able to ensure that the data has completely been read prior to the app starting?

    A code snippet of one file access is below.

                StorageFile CrossRefFile = await StorageFile.GetFileFromApplicationUriAsync(new Uri(ZTConstants.DATAURI + GPCrossRef.CROSSREF_DATA_FILE));

                if (CrossRefFile != null)
                    IList<string> CrossRefContent = await FileIO.ReadLinesAsync(CrossRefFile);



    Tuesday, February 11, 2014 1:59 AM


All replies