HResult doesn't seem to be picked up properly via reflection in the ToError extensions. This could be due to it being a public property and the reflection is checking that it's private: https://docs.microsoft.com/en-us/dotnet/api/system.exception.hresult?msclkid=5283e541cf9b11ec938e45f7252349bc&view=net-6.0
Starting with the .NET Framework 4.5, the HResult property's setter is protected, whereas its getter is public. In previous versions of the .NET Framework, both getter and setter are protected.
I'm thinking that since the library now targets .NET 4.5 and above, we can change our implementation to just check public.
public class MyException : Exception {
public TestOutOfMemoryException(string message) : base(message) {
HResult = unchecked((int)0x8007000E);
}
}
[Fact]
private static void TrackException() {
throw new TestOutOfMemoryException("Test");
throw new OutOfMemoryException("Test");
}
HResultdoesn't seem to be picked up properly via reflection in the ToError extensions. This could be due to it being a public property and the reflection is checking that it's private: https://docs.microsoft.com/en-us/dotnet/api/system.exception.hresult?msclkid=5283e541cf9b11ec938e45f7252349bc&view=net-6.0I'm thinking that since the library now targets .NET 4.5 and above, we can change our implementation to just check public.