Hi,
I have updated my NP2 to 4.3.1 about 3 weeks ago and also upgraded my app to .NET 4.3.
Now I am noticing that the file write seems to kill the whole app.
The app is multi threaded, reading different sensors, which write the data to a file.
i am using the file as a buffer, as the network may be cut, but the app should not miss any readings.
The write is inside a lock, so the threads will not be able to use the same file obj at the same time.
I open the file once in a singleton obj and use it to write and flush the data to file.
Since there is a lot of data going into the file, I do not want to open, wite, flush and close it all the time.
The app can log dozens of readings per sec.
Below is the line where the file gets opened and below that how the data get written to the file.
The last log that is printed is "WriteToFile lock" and after that the whole app just dies.
All thread seem to get blocked.
I would expect multiple "WriteToFile begin" lines, until all thread are stuck at the "WriteToFile begin"
e.g.
WriteToFile begin
WriteToFile lock
WriteToFile begin
WriteToFile begin
WriteToFile begin
WriteToFile begin
m_oWriteFile = new FileStream(m_sLogFileName, FileMode.OpenOrCreate, FileAccess.Write);
protected void WriteToFile(byte[] a_sData) { Debug.Print("WriteToFile begin"); lock (m_oFileLock) { Debug.Print("WriteToFile lock"); try { if (m_oWriteFile != null) { m_oWriteFile.Write(a_sData, 0, a_sData.Length); m_oWriteFile.Flush(); } } catch (Exception ex) { Debug.Print("EXCEPTION: CSdCard:WriteToFile - " + (ex.InnerException == null ? ex.Message : ex.InnerException.Message)); } } Debug.Print("WriteToFile end"); }
With an older firmware version the code above worked fine.
Has anyone got an idea what this could be?
Bug in 4.3.1?