Skip to content

Question: Why do string arrays throw an exception? #25

@mgoldste1

Description

@mgoldste1
 CodeNode GenerateAssignment(KeyValuePair<FieldLayoutAttribute, PropertyInfo> pair)
        {
            var fieldType = pair.Key.FieldType;
            //if this is an array, defer to GenerateArrayAssignment
            if (pair.Key is ArrayFieldLayoutAttribute)
            {
                // TODO: Why do we need these fieldType checks at all?
                if (fieldType == typeof(string))
                {
                    // TODO: Accept string arrays
                    throw new InvalidOperationException(Resources.NoStringArrays);
                }
                if (fieldType == typeof(BitArray))
                {
                    throw new InvalidOperationException(Resources.NoBitArrayArrays);
                }
                return GenerateArrayAssignment(pair);
            }
...
}

The stdf files I'm parsing have some record types that aren't in the spec, but when I search for them on the internet I see other projects implemented them. See https://sprysoftware.net/javadoc/javadoc/spry/reader/stdf/VUR.html I am adding support for these record types:

0-30 - VUR - Version Update Record
1-90 - PSR - Pattern Sequence Record

The VUR record has a string array in it and the code above threw an exception. I commented out the InvalidOperationException for string arrays and it worked fine... so why is it there?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions