System.AccessViolationException In windows but not in linux - C#