NativeString Problem

I am using a NativeString64 and getting an unexpected result. Anyone know why?

NativeString64 nativeString = new NativeString64(“Testing 1 2 3.”);

Below is the actual results and expected results. XXX is Asian characters that are blocked from being posted.

Actual Value
Name Value Type
nativeString.ToString() “TeXXX” System.String
nativeString “TeXXX” Unity.Entities.NativeString64

Expected Value
Name Value Type
nativeString.ToString() “Testing 1 2 3.” System.String
nativeString “Testing 1 2 3.” Unity.Entities.NativeString64

hmm… are you doing anything between instantiation and reading those values?

No code after instantiation, and trying the NativeString.CopyFrom method gives me the same unexpected result.

Hello there.

This is a known bug in all C# debuggers, and does not affect how NativeString64 works at runtime: any struct that contains a fixed int[N]; data member appears in the debugger as one correct integer, followed by N-1 garbage integers. As NativeString64 stores two chars in each integer, the first two chars appear correct, and the rest appear to be garbage.

The garbage is only a cosmetic problem in the debugger, however, and does not affect your code.

Thanks, and good luck

5 Likes