Skip to content

Open fails on real NWD/NWC files: "LcOpNwdGeometry record N: class is not 94 or 95", "f64 alignment pad is not zero", "LcOaPartitionProps … class 70" #291

Backlog

Description

@SergeyPriem

Environment: NwcIO 0.18.0 from NuGet, net10.0, .NET SDK 10.0.202, Windows 11 x64.

var doc = NwcDocument.Open(path, NwcReaderOptions.Default);                        // Strict = false
var geo = NwcDocument.Open(path, new NwcReaderOptions { BuildSceneTree = false });

I tested 11 real files from an industrial plant project. They come from several companies and were saved
from Navisworks. 2 files open fully, 3 open only with BuildSceneTree = false, and 6 do not open at all.
Strict = true gives the same errors.

The three errors

Message Where
E1 LcOaPartitionProps stream S at byte N: class 70, which this slot does not allow scene tree
E2 LcOpNwdLogicalHierarchy at byte N: f64 alignment pad is not zero scene tree
E3 LcOpNwdGeometry record N: class is not 94 or 95 at +4 geometry

Files

File Type Size Format Loader Default options BuildSceneTree = false
A .nwd 121 MB 451 – E1, stream 0, byte 8 opens, geometry only ¹
B .nwc 154 MB 448 lcldifc E1, stream 0, byte 8 opens, geometry only ¹
C .nwc 43 MB 448 lcldifc E1, stream 0, byte 8 opens, geometry only ²
D .nwd 298 MB 448 – E2, byte 816 E3, record 147
E .nwd 56 MB 448 – E1, stream 4, byte 3308644 E3, record 599
F .nwd 9.6 MB 451 – E1, stream 0, byte 8 E3, record 208
G .nwd 9.5 MB 448 – E3, record 12 E3, record 12
H .nwd 21 MB 455 – E1, stream 0, byte 2764 E3, record 465
I .nwd 90 MB 448 – E2, byte 540184 E3, record 3
OK-1 .nwd 77 MB 448 – opens fully ³
OK-2 .nwc 0.5 MB 448 lcldstep opens fully

¹ 111 956 meshes, 23.98 M triangles. No mesh is linked to a node.
² 10 130 meshes, 6.08 M triangles. No mesh is linked to a node.
³ 11.3 M triangles, 1 745 elements with IFC GlobalId and properties.

Format and Loader are FileInfo.FormatVersion and FileInfo.LoaderPlugin, read with every Read* option off
and BuildSceneTree = false. That read works for all 11 files.

Top frames of E1, E2, E3
InvalidDataException: LcOaPartitionProps stream 0 at byte 8: class 70, which this slot does not allow
   at NwcIO.Internal.Parsing.LcObjectReader.ReadPointer(ReadOnlySpan`1 allowedClasses, Func`2 readBody, Boolean allowNull, Boolean allowBackReference)
   at NwcIO.Internal.Parsing.HierarchyParser.Parser.ReadPartitionRoot()
   at NwcIO.Internal.Parsing.HierarchyParser.PartitionRoots.Take()
   at NwcIO.Internal.Parsing.HierarchyParser.Parser.ReadNode(Int32 classId)

InvalidDataException: LcOpNwdLogicalHierarchy at byte 816: f64 alignment pad is not zero
   at NwcIO.Internal.Parsing.LcObjectReader.Align8(String what)
   at NwcIO.Internal.Parsing.LcObjectReader.ReadDouble()
   at NwcIO.Internal.Parsing.HierarchyParser.Parser.ReadMaterial()
   at NwcIO.Internal.Parsing.HierarchyParser.Parser.ReadBody(Int32 classId)

InvalidDataException: LcOpNwdGeometry record 147: class is not 94 or 95 at +4
   at NwcIO.Internal.Parsing.GeometrySegmentReader.ReadAsync(IReadOnlyList`1 chunks, LcRawStream toc, CancellationToken cancellationToken)
   at NwcIO.Internal.Parsing.ModelGraphReader.ReadAsync(ModelSegments segments, NwcReaderOptions options, String rootName, NwcXRefTable xRefs, CancellationToken cancellationToken)
   at NwcIO.NwcDocument.ParseContainer(NwcContainer container, NwcReaderOptions options, Boolean keepStreamCatalog, String fallbackName, IProgress`1 progress, CancellationToken cancellationToken)

The files are confidential client data, so I cannot attach them. I can run a diagnostic build or option on
them and send back output that has no model content: the stream catalog, the class ids and offsets of the
records that fail, or a hex dump of a record header.

Activity

  1. mahach666 commented on Dec 3, 2026

    @mahach666
    Collaborator

    Hi @SergeyPriem, thanks for offering to run a test build. Could you rerun the same 11 files with the code from #292, using the same two settings as in your report? The PR adds support for class-70 IFC properties and class-96 point geometry. The material alignment error (E2) is still under investigation.

    If you prefer the CLI, run this from a clone of NwcIO with .NET SDK 10.0.401 or a later .NET 10 SDK:

    gh pr checkout 292
    dotnet build src/NwcIO.Cli/NwcIO.Cli.csproj -c Release -f net10.0
    dotnet src/NwcIO.Cli/bin/Release/net10.0/NwcIO.Cli.dll "<input>" "<output>.json"
    dotnet src/NwcIO.Cli/bin/Release/net10.0/NwcIO.Cli.dll "<input>" "<output>-no-tree.json" --no-tree

    Please report which file labels now open with each setting and paste the exception messages for any remaining failures. For E3, the new message includes the actual class ID. For E2, the top few stack frames would help confirm where alignment fails. The models and JSON exports can stay local.

  2. SergeyPriem commented on Dec 4, 2026

    @SergeyPriem
    Author

    Thank you. I ran all 11 files with the code of #292 (merge commit 83bc312), with the CLI as you wrote,
    in both modes. .NET SDK 10.0.404, Windows 11 x64; the repository tests pass on this machine (net10.0).
    I also ran a small test program against the same source to get the stack frames, and against main
    (d29c91e, with #293). The failing files give the same result from a local copy (same SHA-256), so this
    is not a sync or read problem on my side.

    Result: 6 of 11 files open fully now (before: 2). A, B, C and F are fixed: the scene tree reads, and
    every mesh is linked to a node. D, E, G, H and I still fail in both modes.

    With --no-tree, the geometry now fails on the same record numbers as E3 before (D 147, E 599, H 465,
    G 12, I 3). In D, E and H the record is class 96 and takes the new point path, but its terminator is not zero.
    In G and I the record class is 105.

    File Format Default --no-tree
    A 451 opens: 111 956 meshes, 23.98 M triangles, 92 270 nodes opens
    B 448 opens: same as A opens
    C 448 opens: 10 130 meshes, 6.08 M triangles, 16 236 nodes opens
    D 448 E2: LcOpNwdLogicalHierarchy at byte 816: f64 alignment pad is not zero LcOpNwdGeometry record 147: point record terminator is not zero at +84
    E 448 LcOpNwdLogicalHierarchy at byte 16998232: string is not valid UTF-8 LcOpNwdGeometry record 599: point record terminator is not zero at +60
    F 451 opens: 18 236 meshes (132 of them point sets), 9.31 M triangles, 11 791 nodes opens
    G 448 LcOpNwdGeometry record 12: class 105 is not 94, 95 or 96 at +4 same
    H 455 LcOaPartitionProps stream 0 at byte 510620: property value type 15 is unknown LcOpNwdGeometry record 465: point record terminator is not zero at +60
    I 448 E2: LcOpNwdLogicalHierarchy at byte 540184: f64 alignment pad is not zero LcOpNwdGeometry record 3: class 105 is not 94, 95 or 96 at +4
    OK-1 448 opens, as before opens
    OK-2 448 opens, as before opens

    With main (#293) the results are the same, except file I with default options:
    LcOpNwdLogicalHierarchy at byte 543836: back-reference in a slot that needs a new object.

    Stack frames (#292, default options)

    E2, file D (in ReadMaterial):

    InvalidDataException: LcOpNwdLogicalHierarchy at byte 816: f64 alignment pad is not zero
       at NwcIO.Internal.Parsing.LcObjectReader.Align8(String what)            LcObjectReader.cs:233
       at NwcIO.Internal.Parsing.LcObjectReader.ReadDouble()                   LcObjectReader.cs:52
       at NwcIO.Internal.Parsing.HierarchyParser.Parser.ReadMaterial()         HierarchyParser.cs:563
       at NwcIO.Internal.Parsing.HierarchyParser.Parser.ReadBody(Int32 classId) HierarchyParser.cs:302
       at NwcIO.Internal.Parsing.LcObjectReader.ReadPointer(...)               LcObjectReader.cs:192
       at NwcIO.Internal.Parsing.HierarchyParser.Parser.ReadNode(Int32 classId) HierarchyParser.cs:357
    

    E2, file I (a different place: the partition trailer, not the material):

    InvalidDataException: LcOpNwdLogicalHierarchy at byte 540184: f64 alignment pad is not zero
       at NwcIO.Internal.Parsing.LcObjectReader.Align8(String what)            LcObjectReader.cs:233
       at NwcIO.Internal.Parsing.LcObjectReader.ReadDouble()                   LcObjectReader.cs:52
       at NwcIO.Internal.Parsing.HierarchyParser.Parser.SkipDoubles(Int32 count) HierarchyParser.cs:417
       at NwcIO.Internal.Parsing.HierarchyParser.Parser.ReadPartitionTrailer() HierarchyParser.cs:397
       at NwcIO.Internal.Parsing.HierarchyParser.Parser.ReadNode(Int32 classId) HierarchyParser.cs:380
       at NwcIO.Internal.Parsing.HierarchyParser.Parser.ReadBody(Int32 classId) HierarchyParser.cs:299
    

    File I on main (#293):

    InvalidDataException: LcOpNwdLogicalHierarchy at byte 543836: back-reference in a slot that needs a new object
       at NwcIO.Internal.Parsing.LcObjectReader.ReadPointer(...)               LcObjectReader.cs:153
       at NwcIO.Internal.Parsing.HierarchyParser.Parser.ReadPartitionTrailer() HierarchyParser.cs:401
       at NwcIO.Internal.Parsing.HierarchyParser.Parser.ReadNode(Int32 classId) HierarchyParser.cs:382
       at NwcIO.Internal.Parsing.HierarchyParser.Parser.ReadBody(Int32 classId) HierarchyParser.cs:300
       at NwcIO.Internal.Parsing.LcObjectReader.ReadPointer(...)               LcObjectReader.cs:195
       at NwcIO.Internal.Parsing.HierarchyParser.Parser.ReadNodes(...)         HierarchyParser.cs:325
    

    File E (UTF-8, also in ReadMaterial):

    InvalidDataException: LcOpNwdLogicalHierarchy at byte 16998232: string is not valid UTF-8
       at NwcIO.Internal.Parsing.LcObjectReader.ReadString()                   LcObjectReader.cs:76
       at NwcIO.Internal.Parsing.HierarchyParser.Parser.ReadMaterial()         HierarchyParser.cs:560
       at NwcIO.Internal.Parsing.HierarchyParser.Parser.ReadBody(Int32 classId) HierarchyParser.cs:302
    

    File H:

    InvalidDataException: LcOaPartitionProps stream 0 at byte 510620: property value type 15 is unknown
       at NwcIO.Internal.Parsing.HierarchyParser.Parser.ReadPropertyTab()      HierarchyParser.cs:488
       at NwcIO.Internal.Parsing.HierarchyParser.Parser.ReadBody(Int32 classId) HierarchyParser.cs:301
       at NwcIO.Internal.Parsing.LcObjectReader.ReadPointer(...)               LcObjectReader.cs:192
       at NwcIO.Internal.Parsing.HierarchyParser.Parser.ReadPartitionRoot()    HierarchyParser.cs:293
    

    All geometry errors (point record terminator, class 105) come from
    GeometrySegmentReader.ReadAsync (GeometrySegmentReader.cs:37).

    A small request, not a bug. The docs say NwcNode.IfcGlobalId is set only on Revit element nodes, and that
    is what I see. A, B and C are built from IFC (lcldifc), and their GlobalId is in the properties:
    Element / GlobalId and Element / IfcGUID (43 372 times in A, 7 775 times in C). Could IfcGlobalId be
    filled from these properties for IFC-built files? We use the GlobalId to link a model element to our
    equipment list.

    I can run the next build on the same files at any time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions