Folleach / GeometryDashAPI

API for Geometry Dash
MIT License
62 stars 8 forks source link

String moves while parsing isn't done yet on .net 4.8 #25

Closed Folleach closed 1 year ago

Folleach commented 1 year ago

Describe the bug

see ddc84d58accbf3039146bf79d36fc5fbf3674a80 to learn about the temporary fix

During parsing, a lot of ReadOnlySpan<char> is created reffered to the main string
At one moment the data in span turns into a pile of garbage
Test Decode_SampleStruct_ShouldBeCorrect can catch this behavior

Folleach commented 1 year ago

This appens because implementation of new ReadOnlySpan<char>(pointer, length) in net framework does not keep itself pinnable inside, this allows the GC to move the string that is being worked on...

So, I'll just change the constructor to the Slice method in LLParserSpan, because Slice saves pinnable object