Getting a weird Input System error

Unexpected exception System.ExecutionEngineException: String conversion error: Illegal byte sequence encounted in the input.
  at (wrapper managed-to-native) System.Runtime.InteropServices.Marshal.PtrToStringAnsi(intptr)
  at Burst.Compiler.IL.Jit.JitCompiler+<>c__DisplayClass30_0.<CompileMethodInternal>b__0 (System.IntPtr namePtr) [0x00000] in <9ef6d63a07094e61a8a21dbbd5c9c8fd>:0
  at (wrapper managed-to-native) System.Object.wrapper_native_0x1c1a87fd0(Burst.Compiler.IL.Jit.JitCompiler/ResolveExternalFunctionDelegate)
  at Burst.Compiler.IL.Jit.JitCompiler.CompileMethodInternal (Burst.Compiler.IL.Jit.JitResult result, System.Collections.Generic.List`1[T] methodsToCompile, Burst.Compiler.IL.Jit.JitOptions jitOptions) [0x00517] in <9ef6d63a07094e61a8a21dbbd5c9c8fd>:0
  at Burst.Compiler.IL.Jit.JitCompiler.CompileMethods (Mono.Cecil.MethodReference[] methodReferences, Burst.Compiler.IL.Jit.JitOptions jitOptions) [0x00254] in <9ef6d63a07094e61a8a21dbbd5c9c8fd>:0
  at Burst.Compiler.IL.Jit.JitCompiler.CompileMethod (Mono.Cecil.MethodReference methodReference, Burst.Compiler.IL.Jit.JitOptions jitOptions) [0x0001c] in <9ef6d63a07094e61a8a21dbbd5c9c8fd>:0
  at Burst.Compiler.IL.Jit.JitCompilerService+CompilerThreadContext.Compile (Burst.Compiler.IL.Jit.JitCompilerService+CompileJob job) [0x00396] in <9ef6d63a07094e61a8a21dbbd5c9c8fd>:0
While compiling job: System.Void Unity.Entities.StructuralChange::RemoveComponentChunksExecute(Unity.Entities.EntityComponentStore*,Unity.Entities.ArchetypeChunk*,System.Int32,System.Int32)
at <empty>:line 0

Happens when playing in the editor. Not sure what impact it has.

Going only by the stack trace, this doesn’t look related to the input system. Looks more like a potential Burst issue. The only way for the input system to impact that string data seems if there was a memory corruption.

Ok cheers. Have just updated burst so might go away.

I have encountered the same problem. The reason for the error is that the main thread called Marshal.FreeHGlobal(IntPtr) before another thread executed PtrToStringAnsi. Make sure you don’t call Marshal.FreeHGlobal(IntPtr) before the end of the thread that needs the IntPtr to be used.