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

Issue reading strings #28

Open
carlm83 opened this issue Jan 20, 2020 · 7 comments
Open

Issue reading strings #28

carlm83 opened this issue Jan 20, 2020 · 7 comments
Assignees
Labels

Comments

@carlm83
Copy link

carlm83 commented Jan 20, 2020

I have a large file that I'm trying to read. Sample is attached. All of the numeric values appear to read fine, but some of the strings are corrupted.

Here is the code I used to read the data:

using (var output = new System.IO.StreamWriter(System.IO.File.Create(@"C:\Carl\tdms_example.txt")) )
using (var tdms = new NationalInstruments.Tdms.File(openFileDialog1.FileName) )
{
    tdms.Open();

    output.WriteLine("Properties:");

    foreach ( var property in tdms.Properties )
    {
        output.WriteLine("  {0}: {1}", property.Key, property.Value);
    }

    output.WriteLine();

    foreach ( var group in tdms )
    {
        output.WriteLine("    Group: {0}", group.Name);

        foreach ( var property in group.Properties )
        {
            output.WriteLine("    {0}: {1}", property.Key, property.Value);
        }

        output.WriteLine();

        foreach ( var channel in group )
        {
            output.WriteLine("        Channel: {0}", channel.Name);

            foreach ( var property in channel.Properties )
            {
                output.WriteLine("        {0}: {1}", property.Key, property.Value);
            }

            output.WriteLine();
        }
    }
}

Attached is the output data. See "Channel: 1850-5 Lower Element" for an example of the data corruption.

The Excel importer add-in reads the TDMS file fine so I don't believe it is corrupted.

tdms_example.txt

String Issue Sample.zip

@mettekou mettekou added the bug label Jan 20, 2020
@mettekou mettekou self-assigned this Jan 20, 2020
@mettekou
Copy link
Collaborator

mettekou commented Jan 21, 2020

@carlm83 Could you tell me which application on which operating system produced the TDMS file in question? Could you also tell me whether any of the strings contain non-ASCII characters?

@carlm83
Copy link
Author

carlm83 commented Jan 23, 2020

LabView 2019 created the TDMS file. The computer it is x64 running on is Windows 10 Pro, version 10.0.18362 build 18362. There should be no non-ASCII characters.

@carlm83
Copy link
Author

carlm83 commented Feb 18, 2020

@mettekou Any update on this? Thanks

@mettekou
Copy link
Collaborator

@carlm83 I have been able to reproduce the issue and have stepped through the code with your example TDMS file and channel path as an input. It seems the computed offset for the given channel's raw data is off by one byte. I have not been able to address this issue yet, as I do not fully understand its cause.

@mettekou
Copy link
Collaborator

@carlm83 If this issue is still relevant to you and your application can target .NET 5.0, note that FSharp.Data.Tdms reads your TDMS file just fine.

@carlm83
Copy link
Author

carlm83 commented Jan 11, 2021 via email

@mettekou
Copy link
Collaborator

@carlm83 Note that you do not have to switch to F# to use FSharp.Data.Tdms, it also provides an API for C#.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants