From 5704403030f8781da651c261fc4a4b50360c675c Mon Sep 17 00:00:00 2001 From: Dmitry Pentin Date: Fri, 21 May 2021 20:52:38 +0300 Subject: [PATCH] Implemented ThrowObjectDisposedException for the ThrowHelper, replaced raw throws with this in Image/ImageFrameCollection --- src/ImageSharp/Image.cs | 2 +- src/ImageSharp/ImageFrameCollection.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ImageSharp/Image.cs b/src/ImageSharp/Image.cs index 724fa4f96b..fe72ec5c00 100644 --- a/src/ImageSharp/Image.cs +++ b/src/ImageSharp/Image.cs @@ -161,7 +161,7 @@ namespace SixLabors.ImageSharp { if (this.isDisposed) { - throw new ObjectDisposedException("Trying to execute an operation on a disposed image."); + ThrowHelper.ThrowObjectDisposedException(this.GetType()); } } diff --git a/src/ImageSharp/ImageFrameCollection.cs b/src/ImageSharp/ImageFrameCollection.cs index 16d4285782..8c8edcd7a5 100644 --- a/src/ImageSharp/ImageFrameCollection.cs +++ b/src/ImageSharp/ImageFrameCollection.cs @@ -196,9 +196,9 @@ namespace SixLabors.ImageSharp /// protected void EnsureNotDisposed() { - if(this.isDisposed) + if (this.isDisposed) { - throw new ObjectDisposedException("Trying to execute an operation on a disposed image frame."); + ThrowHelper.ThrowObjectDisposedException(this.GetType()); } }