private void OnLoaded(object sender, RoutedEventArgs e) { var ptr = MyAdapter.GetMyVersionPtr(); var convertedString = Marshal.PtrToStringAnsi(ptr); // This crashes in x64 build var directString = MyAdapter.GetMyVersionString(); VersionTextBlock.Text = convertedString; }