From 11d1ad92cf0334bb0f8bd22072cc419858d6fbd5 Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Sat, 7 Oct 2023 12:30:16 +0200 Subject: [PATCH] Use Marshal.GetHRForException everywhere --- .../D2D1TransformMapperImpl.ID2D1TransformMapper.cs | 6 +++--- .../Interop/ID3D12MemoryAllocatorFactoryImpl.cs | 2 +- .../Interop/IWICStreamExtensions.IBufferWriter.cs | 4 ++-- .../Interop/IWICStreamExtensions.Stream.cs | 12 ++++++------ 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/TransformMappers/D2D1TransformMapperImpl.ID2D1TransformMapper.cs b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/TransformMappers/D2D1TransformMapperImpl.ID2D1TransformMapper.cs index 6d302318..e3e616b8 100644 --- a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/TransformMappers/D2D1TransformMapperImpl.ID2D1TransformMapper.cs +++ b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/TransformMappers/D2D1TransformMapperImpl.ID2D1TransformMapper.cs @@ -131,7 +131,7 @@ unsafe partial struct D2D1TransformMapperImpl } catch (Exception e) { - return e.HResult; + return Marshal.GetHRForException(e); } *outputRect = output.ToRECT(); @@ -163,7 +163,7 @@ unsafe partial struct D2D1TransformMapperImpl } catch (Exception e) { - return e.HResult; + return Marshal.GetHRForException(e); } for (int i = 0; i < (int)inputRectsCount; i++) @@ -192,7 +192,7 @@ unsafe partial struct D2D1TransformMapperImpl } catch (Exception e) { - return e.HResult; + return Marshal.GetHRForException(e); } *invalidOutputRect = invalidOutput.ToRECT(); diff --git a/src/ComputeSharp.D3D12MemoryAllocator/Interop/ID3D12MemoryAllocatorFactoryImpl.cs b/src/ComputeSharp.D3D12MemoryAllocator/Interop/ID3D12MemoryAllocatorFactoryImpl.cs index 2795efa4..35aa47dc 100644 --- a/src/ComputeSharp.D3D12MemoryAllocator/Interop/ID3D12MemoryAllocatorFactoryImpl.cs +++ b/src/ComputeSharp.D3D12MemoryAllocator/Interop/ID3D12MemoryAllocatorFactoryImpl.cs @@ -165,7 +165,7 @@ internal unsafe struct ID3D12MemoryAllocatorFactoryImpl } catch (Exception e) { - return e.HResult; + return Marshal.GetHRForException(e); } } } \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Extensions/Interop/IWICStreamExtensions.IBufferWriter.cs b/src/ComputeSharp/Graphics/Extensions/Interop/IWICStreamExtensions.IBufferWriter.cs index 54c34722..2f4de787 100644 --- a/src/ComputeSharp/Graphics/Extensions/Interop/IWICStreamExtensions.IBufferWriter.cs +++ b/src/ComputeSharp/Graphics/Extensions/Interop/IWICStreamExtensions.IBufferWriter.cs @@ -373,7 +373,7 @@ unsafe partial class IWICStreamExtensions } catch (Exception ex) { - return ex.HResult; + return Marshal.GetHRForException(ex); } } @@ -454,7 +454,7 @@ unsafe partial class IWICStreamExtensions } catch (Exception ex) { - return ex.HResult; + return Marshal.GetHRForException(ex); } } diff --git a/src/ComputeSharp/Graphics/Extensions/Interop/IWICStreamExtensions.Stream.cs b/src/ComputeSharp/Graphics/Extensions/Interop/IWICStreamExtensions.Stream.cs index c471afd5..9481099b 100644 --- a/src/ComputeSharp/Graphics/Extensions/Interop/IWICStreamExtensions.Stream.cs +++ b/src/ComputeSharp/Graphics/Extensions/Interop/IWICStreamExtensions.Stream.cs @@ -380,7 +380,7 @@ internal static unsafe partial class IWICStreamExtensions } catch (Exception ex) { - return ex.HResult; + return Marshal.GetHRForException(ex); } } @@ -416,7 +416,7 @@ internal static unsafe partial class IWICStreamExtensions } catch (Exception ex) { - return ex.HResult; + return Marshal.GetHRForException(ex); } } @@ -454,7 +454,7 @@ internal static unsafe partial class IWICStreamExtensions } catch (Exception ex) { - return ex.HResult; + return Marshal.GetHRForException(ex); } } @@ -475,7 +475,7 @@ internal static unsafe partial class IWICStreamExtensions } catch (Exception ex) { - return ex.HResult; + return Marshal.GetHRForException(ex); } } @@ -498,7 +498,7 @@ internal static unsafe partial class IWICStreamExtensions } catch (Exception ex) { - return ex.HResult; + return Marshal.GetHRForException(ex); } } @@ -587,7 +587,7 @@ internal static unsafe partial class IWICStreamExtensions pstatstg->pwcsName = null; } - return ex.HResult; + return Marshal.GetHRForException(ex); } }