diff --git a/src/Umbraco.Core/Exceptions/DataOperationException.cs b/src/Umbraco.Core/Exceptions/DataOperationException.cs index 233f9ccf21..c004e391fe 100644 --- a/src/Umbraco.Core/Exceptions/DataOperationException.cs +++ b/src/Umbraco.Core/Exceptions/DataOperationException.cs @@ -8,9 +8,9 @@ namespace Umbraco.Core.Exceptions /// /// /// - [Obsolete("Refactor the generic type to a concrete serializable type.")] [Serializable] internal class DataOperationException : Exception + where T : Enum { /// /// Gets the operation. @@ -74,7 +74,7 @@ namespace Umbraco.Core.Exceptions protected DataOperationException(SerializationInfo info, StreamingContext context) : base(info, context) { - Operation = (T)info.GetValue(nameof(Operation), typeof(T)); + Operation = (T)Enum.Parse(typeof(T), info.GetString(nameof(Operation))); } /// @@ -90,7 +90,7 @@ namespace Umbraco.Core.Exceptions throw new ArgumentNullException(nameof(info)); } - info.AddValue(nameof(Operation), Operation); + info.AddValue(nameof(Operation), Enum.GetName(typeof(T), Operation)); base.GetObjectData(info, context); }