HRESULT.ToString() throws System.OverflowException: Value was either too large or too small for a UInt32.
I tried updating our Project references Vanara.PInvoke.CldApi (3.4.17) and Vanara.PInvoke.SearchApi (3.4.17) to 4.0.1.
After updating the above mentioned exception is thrown when cloud API calls fail with a Win32 error code which was not the case before.
ToString() should succeed and return HRESULT_FROM_WIN32(ERROR_CLOUD_FILE_NOT_UNDER_SYNC_ROOT): The operation is only supported on files under a cloud sync root.
Repro is very simple by creating a HRESULT object from the error code returned by the Cloud API directly:
static void Main(string[] args)
{
HRESULT hRESULT = HRESULT.HRESULT_FROM_WIN32(Win32Error.ERROR_CLOUD_FILE_NOT_UNDER_SYNC_ROOT);
//Should print: HRESULT_FROM_WIN32(ERROR_CLOUD_FILE_NOT_UNDER_SYNC_ROOT): The operation is only supported on files under a cloud sync root.
//Throws: HRESULT.ToString() throws `System.OverflowException: Value was either too large or too small for a UInt32.`
Console.WriteLine("" + hRESULT);
Console.Read();
}
I think this is fixed. I've tested your condition without failure with the pre-4.0.2 build. It should be available to test shortly from the AppVeyor feed (see homepage).
Describe the bug and how to reproduce
HRESULT.ToString() throws
System.OverflowException: Value was either too large or too small for a UInt32.
I tried updating our Project references Vanara.PInvoke.CldApi (3.4.17) and Vanara.PInvoke.SearchApi (3.4.17) to 4.0.1. After updating the above mentioned exception is thrown when cloud API calls fail with a Win32 error code which was not the case before.
Stacktrace:
What code is involved
Vanara.PInvoke.Shared 4.0.1 .NET Runtime 8.0.5
Expected behavior
ToString() should succeed and return
HRESULT_FROM_WIN32(ERROR_CLOUD_FILE_NOT_UNDER_SYNC_ROOT): The operation is only supported on files under a cloud sync root.
Repro is very simple by creating a HRESULT object from the error code returned by the Cloud API directly: