I have an application that logs data to a TDMS 2.0 file, LV 2009 SP1, Windows 7 x32.
Initially, I set it up so that the app opens one R/W reference to the file. The state machine program writes data to the file in one step, then reads back the last 1000 points in another. The logging is slow, roughly 1Hz. There is no possibility of concurrent Reads and Writes.
When the program closes, I call the TDMS CLOSE method.
When I restart and try to read the data, I get error -2511/0xFFFFF631 "LabVIEW: The specified TDMS file is corrupt." Every time.
When I try and open the file in the TDMS viewer, the viewer shows the wrong number of samples in the properties, then shows no data at all (I assume it's eating the error, since it does not present it to me).
I have tried:
1) commenting out the code that reads. No good.
2) Opening a separate reference each time I wish to make a read. Nope.
3) Buffer On/Off
5) Deleting the index and trying again.
6) Removing the CLOSE function
7) Killing the app instead of gracefully closing
😎 Changing the filename/path
9) Writing to an SSD disk
10) Writing to a SATA disk.
None of that works. Essentially, the TDMS file is fine until it is closed. Then it is corrupt.
I have a couple of questions:
Have you tried with the latest TDMS component? It's free to download, and here it is: http://zone.ni.com/devzone/cda/tut/p/id/9995
Is that possible or convenient for you to post your reproducible VI here, it would be great helpful for us to look into?
I have made a very simple VI for recovery corrupted TDMS files, attached in this post, maybe you can have a try, but please backup your file before trying.
I can't post that code here, as it is under NDA.
I can try and reproduce it, if I can do that quickly I will.
I installed the 206 update and it seems to have no effect (assuming that it installed into my LV 2009 installation, it did not ask when I launched it)
I forgot to mention that your utility did not fix the file, but thank you.
Is this something that upgrading to LV2010 can fix?
Not sure, TDMS has 2 parts in LabVIEW, one is for tdms.dll which you already tried, the other is in LabVIEW.exe. If it's not convenient for you to post the entire VI application, could you please have a simple reproducible VI for this problem, just with some TDMS nodes, without of any confidential stuff?
Grrrrrrr. Same issue with 2010.
I just stripped the code out to post it, but it doesn't error in that form.
I tried to rip the code out and send you an example, but it would work fine.
I eventually figured out that it did not like that I was sending it an array of EXT. When I cast the array to DBL, I no longer saw any corruption.
I am storing an array of scalar data (non-waveform) with a timestamp; I want to ensure that the TS is saved with all the other data, so I am casting it to 2 DBLs and adding that to the array.