Fix gltf parsing from wrong offset #2

Merged
themixedupstuff merged 2 commits from JoeTwizzle/ReFuel.Gltf:master into master 2026-10-25 19:50:39 +01:00
Contributor

Seeks the actual StreamWrapper to the beginning instead of the original stream since that is what is actually used for parsing. This makes most tests pass

Seeks the actual StreamWrapper to the beginning instead of the original stream since that is what is actually used for parsing. This makes most tests pass
JoeTwizzle added 1 commit 2026-10-25 17:55:46 +01:00
Owner

One of the tests were failing due to an upstream bug. Do you have the earlier test reports? I'm curious what the exception was.

One of the tests were failing due to an upstream bug. Do you have the earlier test reports? I'm curious what the exception was.
Author
Contributor

Previously all tests were failing for .gltf files with the same error. (example from AssertTexturesCount with "bathroom_extended.gltf")

1)   AssertTexturesCount (Gltf JSON "bathroom_extended.gltf" HasValidation=Yes) 
      Duration: 21 ms

      Message: 
Test method ReFuel.Gltf.Tests.ParseCompliantDocuments.AssertTexturesCount threw exception:
System.Text.Json.JsonReaderException: ',' is invalid after a single JSON value. Expected end of data. LineNumber: 3 | BytePositionInLine: 3.

      Stack Trace: 
ThrowHelper.ThrowJsonReaderException(Utf8JsonReader& json, ExceptionResource resource, Byte nextByte, ReadOnlySpan`1 bytes)
Utf8JsonReader.ConsumeNextTokenUntilAfterAllCommentsAreSkipped(Byte marker)
Utf8JsonReader.ConsumeNextTokenOrRollback(Byte marker)
Utf8JsonReader.ReadSingleSegment()
Utf8JsonReader.Read()
JsonDocument.Parse(ReadOnlySpan`1 utf8JsonSpan, JsonReaderOptions readerOptions, MetadataDb& database, StackRowStack& stack)
JsonDocument.Parse(ReadOnlyMemory`1 utf8Json, JsonReaderOptions readerOptions, Byte[] extraRentedArrayPoolBytes, PooledByteBufferWriter extraPooledByteBufferWriter, Boolean allowDuplicateProperties)
JsonDocument.Parse(Stream utf8Json, JsonDocumentOptions options)
GltfDocument.OpenJson(StreamWrapper str) line 107
GltfDocument.Open(Stream str, GltfDocumentKind kind) line 193
GltfTestDocument.Parse() line 33
ParseCompliantDocuments.AssertTexturesCount(GltfTestDocument doc) line 68
MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args)
MethodBaseInvoker.InvokeDirectByRefWithFewArgs(Object obj, Span`1 copyOfArgs, BindingFlags invokeAttr)
Previously all tests were failing for .gltf files with the same error. (example from AssertTexturesCount with "bathroom_extended.gltf") ``` 1)   AssertTexturesCount (Gltf JSON "bathroom_extended.gltf" HasValidation=Yes)  Duration: 21 ms Message:  Test method ReFuel.Gltf.Tests.ParseCompliantDocuments.AssertTexturesCount threw exception: System.Text.Json.JsonReaderException: ',' is invalid after a single JSON value. Expected end of data. LineNumber: 3 | BytePositionInLine: 3. Stack Trace:  ThrowHelper.ThrowJsonReaderException(Utf8JsonReader& json, ExceptionResource resource, Byte nextByte, ReadOnlySpan`1 bytes) Utf8JsonReader.ConsumeNextTokenUntilAfterAllCommentsAreSkipped(Byte marker) Utf8JsonReader.ConsumeNextTokenOrRollback(Byte marker) Utf8JsonReader.ReadSingleSegment() Utf8JsonReader.Read() JsonDocument.Parse(ReadOnlySpan`1 utf8JsonSpan, JsonReaderOptions readerOptions, MetadataDb& database, StackRowStack& stack) JsonDocument.Parse(ReadOnlyMemory`1 utf8Json, JsonReaderOptions readerOptions, Byte[] extraRentedArrayPoolBytes, PooledByteBufferWriter extraPooledByteBufferWriter, Boolean allowDuplicateProperties) JsonDocument.Parse(Stream utf8Json, JsonDocumentOptions options) GltfDocument.OpenJson(StreamWrapper str) line 107 GltfDocument.Open(Stream str, GltfDocumentKind kind) line 193 GltfTestDocument.Parse() line 33 ParseCompliantDocuments.AssertTexturesCount(GltfTestDocument doc) line 68 MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args) MethodBaseInvoker.InvokeDirectByRefWithFewArgs(Object obj, Span`1 copyOfArgs, BindingFlags invokeAttr) ```
JoeTwizzle added 1 commit 2026-10-25 19:13:11 +01:00
themixedupstuff merged commit 3087ea546d into master 2026-10-25 19:50:39 +01:00
Sign in to join this conversation.