diff --git a/src/libraries/System.Memory/tests/MemoryMarshal/GetReference.cs b/src/libraries/System.Memory/tests/MemoryMarshal/GetReference.cs index 9760c88c2a1f8..8b5f6560e3fb5 100644 --- a/src/libraries/System.Memory/tests/MemoryMarshal/GetReference.cs +++ b/src/libraries/System.Memory/tests/MemoryMarshal/GetReference.cs @@ -107,13 +107,13 @@ public static void ReadOnlySpanGetReferenceAndReadInteger() Assert.Equal(BitConverter.IsLittleEndian ? 0x65_00_68 : 0x68_00_65, - Unsafe.As(ref Unsafe.Add(ref Unsafe.As( + Unsafe.ReadUnaligned(ref Unsafe.Add(ref Unsafe.As( ref MemoryMarshal.GetReference("hello world 1".AsSpan())), 0))); Assert.Equal(BitConverter.IsLittleEndian ? 0x6F_00_6C_00_6C_00_65_00 : - 0x00_65_00_6C_00_6C_00_6F, - Unsafe.As(ref Unsafe.Add(ref Unsafe.As( + 0x68_00_65_00_6C_00_6C_00, + Unsafe.ReadUnaligned(ref Unsafe.Add(ref Unsafe.As( ref MemoryMarshal.GetReference("hello world 2".AsSpan())), 1))); } }