mirror of https://github.com/dahall/Vanara.git
Fixed #467 where IErrorHandler types threw error on ToString method after 4.0.1.
parent
949f6bb8d2
commit
4b398b3f73
|
@ -27,7 +27,7 @@ public static class ErrorHelper
|
||||||
{
|
{
|
||||||
if (!lookupHelpers.TryGetValue(typeof(TType), out var lookupFunc))
|
if (!lookupHelpers.TryGetValue(typeof(TType), out var lookupFunc))
|
||||||
lookupFunc = FormatMessage;
|
lookupFunc = FormatMessage;
|
||||||
return lookupFunc(id.ToUInt32(null), lib ?? StaticFieldValueHash.GetFieldLib<TType, TFieldType>(id));
|
return lookupFunc(unchecked((uint)id.ToInt64(null)), lib ?? StaticFieldValueHash.GetFieldLib<TType, TFieldType>(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Formats the message.</summary>
|
/// <summary>Formats the message.</summary>
|
||||||
|
|
|
@ -121,6 +121,12 @@ public class Win32ErrorTests
|
||||||
[TestCase(0x00990003U, "0x00990003")]
|
[TestCase(0x00990003U, "0x00990003")]
|
||||||
public void ToStringTest(uint c, string val) => Assert.That(new Win32Error(c).ToString(), Does.StartWith(val));
|
public void ToStringTest(uint c, string val) => Assert.That(new Win32Error(c).ToString(), Does.StartWith(val));
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void ToStringHRESULTTest()
|
||||||
|
{
|
||||||
|
Assert.That(new Win32Error(Win32Error.ERROR_CLOUD_FILE_NOT_UNDER_SYNC_ROOT).ToHRESULT().ToString(), Does.StartWith("HRESULT_FROM_WIN32(ERROR_CLOUD_FILE_NOT_UNDER_SYNC_ROOT"));
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TypeConverterTest()
|
public void TypeConverterTest()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue