"reason": "https://github.com/dotnet/coreclr/pull/23664"
},
{
+ "name": "System.Runtime.InteropServices.Tests.PtrToStringUTF8.PtrToStringUTF8_NegativeLength_ThrowsArgumentOutOfRangeExeption",
+ "reason": "https://github.com/dotnet/coreclr/pull/23731"
+ },
+ {
+ "name": "System.Runtime.InteropServices.Tests.PtrToStringUTF8.PtrToStringUTF8_ZeroPointer_ReturnsNull",
+ "reason": "https://github.com/dotnet/coreclr/pull/23731"
+ },
+ {
+ "name": "System.Runtime.InteropServices.Tests.PtrToStringUTF8.PtrToStringUTF8_Win32AtomPointer_ReturnsNull",
+ "reason": "https://github.com/dotnet/coreclr/pull/23731"
+ },
+ {
+ "name": "System.Runtime.InteropServices.Tests.PtrToStringAnsiTests.PtrToStringAnsi_NegativeLength_ThrowsArgumentExeption",
+ "reason": "https://github.com/dotnet/coreclr/pull/23731"
+ },
+ {
+ "name": "System.Runtime.InteropServices.Tests.PtrToStringUniTests.PtrToStringUni_NegativeLength_ThrowsArgumentExeption",
+ "reason": "https://github.com/dotnet/coreclr/pull/23731"
+ },
+ {
"name": "System.Runtime.InteropServices.Tests.ThrowExceptionForHRTests.ThrowExceptionForHR_NoErrorInfo_ReturnsValidException",
"reason": "outdated"
},
}
if (len < 0)
{
- throw new ArgumentException(null, nameof(len));
+ throw new ArgumentOutOfRangeException(nameof(len), len, SR.ArgumentOutOfRange_NeedNonNegNum);
}
return new string((sbyte*)ptr, 0, len);
}
if (len < 0)
{
- throw new ArgumentException(SR.ArgumentOutOfRange_NeedNonNegNum, nameof(len));
+ throw new ArgumentOutOfRangeException(nameof(len), len, SR.ArgumentOutOfRange_NeedNonNegNum);
}
return new string((char*)ptr, 0, len);
public static unsafe string PtrToStringUTF8(IntPtr ptr)
{
- if (ptr == IntPtr.Zero)
+ if (ptr == IntPtr.Zero || IsWin32Atom(ptr))
{
return null;
}
public static unsafe string PtrToStringUTF8(IntPtr ptr, int byteLen)
{
- if (byteLen < 0)
+ if (ptr == IntPtr.Zero)
{
- throw new ArgumentOutOfRangeException(nameof(byteLen), SR.ArgumentOutOfRange_NeedNonNegNum);
+ throw new ArgumentNullException(nameof(ptr));
}
-
- if (ptr == IntPtr.Zero || IsWin32Atom(ptr))
+ if (byteLen < 0)
{
- return null;
+ throw new ArgumentOutOfRangeException(nameof(byteLen), byteLen, SR.ArgumentOutOfRange_NeedNonNegNum);
}
return string.CreateStringFromEncoding((byte*)ptr, byteLen, Encoding.UTF8);