removed syslib003 & syslib0051 obsoleted code dependencies (#18827)
Followed guidance in https://learn.microsoft.com/en-us/dotnet/fundamentals/syslib-diagnostics/syslibxxxx
This commit is contained in:
@@ -6,7 +6,6 @@ namespace Umbraco.Cms.Core.Exceptions;
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <seealso cref="System.Exception" />
|
||||
[Serializable]
|
||||
public class DataOperationException<T> : Exception
|
||||
where T : Enum
|
||||
{
|
||||
@@ -57,22 +56,6 @@ public class DataOperationException<T> : Exception
|
||||
: base(message) =>
|
||||
Operation = operation;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="DataOperationException{T}" /> class.
|
||||
/// </summary>
|
||||
/// <param name="info">
|
||||
/// The <see cref="T:System.Runtime.Serialization.SerializationInfo" /> that holds the serialized object
|
||||
/// data about the exception being thrown.
|
||||
/// </param>
|
||||
/// <param name="context">
|
||||
/// The <see cref="T:System.Runtime.Serialization.StreamingContext" /> that contains contextual
|
||||
/// information about the source or destination.
|
||||
/// </param>
|
||||
/// <exception cref="ArgumentNullException">info</exception>
|
||||
protected DataOperationException(SerializationInfo info, StreamingContext context)
|
||||
: base(info, context) =>
|
||||
Operation = (T)Enum.Parse(typeof(T), info.GetString(nameof(Operation)) ?? string.Empty);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the operation.
|
||||
/// </summary>
|
||||
@@ -83,29 +66,4 @@ public class DataOperationException<T> : Exception
|
||||
/// This object should be serializable to prevent a <see cref="SerializationException" /> to be thrown.
|
||||
/// </remarks>
|
||||
public T? Operation { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// When overridden in a derived class, sets the <see cref="T:System.Runtime.Serialization.SerializationInfo" /> with
|
||||
/// information about the exception.
|
||||
/// </summary>
|
||||
/// <param name="info">
|
||||
/// The <see cref="T:System.Runtime.Serialization.SerializationInfo" /> that holds the serialized object
|
||||
/// data about the exception being thrown.
|
||||
/// </param>
|
||||
/// <param name="context">
|
||||
/// The <see cref="T:System.Runtime.Serialization.StreamingContext" /> that contains contextual
|
||||
/// information about the source or destination.
|
||||
/// </param>
|
||||
/// <exception cref="ArgumentNullException">info</exception>
|
||||
public override void GetObjectData(SerializationInfo info, StreamingContext context)
|
||||
{
|
||||
if (info == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(info));
|
||||
}
|
||||
|
||||
info.AddValue(nameof(Operation), Operation is not null ? Enum.GetName(typeof(T), Operation) : string.Empty);
|
||||
|
||||
base.GetObjectData(info, context);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,6 @@ namespace Umbraco.Cms.Core.Exceptions;
|
||||
/// The exception that is thrown when a composition is invalid.
|
||||
/// </summary>
|
||||
/// <seealso cref="System.Exception" />
|
||||
[Serializable]
|
||||
public class InvalidCompositionException : Exception
|
||||
{
|
||||
/// <summary>
|
||||
@@ -77,26 +76,6 @@ public class InvalidCompositionException : Exception
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="InvalidCompositionException" /> class.
|
||||
/// </summary>
|
||||
/// <param name="info">
|
||||
/// The <see cref="T:System.Runtime.Serialization.SerializationInfo" /> that holds the serialized object
|
||||
/// data about the exception being thrown.
|
||||
/// </param>
|
||||
/// <param name="context">
|
||||
/// The <see cref="T:System.Runtime.Serialization.StreamingContext" /> that contains contextual
|
||||
/// information about the source or destination.
|
||||
/// </param>
|
||||
protected InvalidCompositionException(SerializationInfo info, StreamingContext context)
|
||||
: base(info, context)
|
||||
{
|
||||
ContentTypeAlias = info.GetString(nameof(ContentTypeAlias));
|
||||
AddedCompositionAlias = info.GetString(nameof(AddedCompositionAlias));
|
||||
PropertyTypeAliases = (string[]?)info.GetValue(nameof(PropertyTypeAliases), typeof(string[]));
|
||||
PropertyGroupAliases = (string[]?)info.GetValue(nameof(PropertyGroupAliases), typeof(string[]));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the content type alias.
|
||||
/// </summary>
|
||||
@@ -129,34 +108,6 @@ public class InvalidCompositionException : Exception
|
||||
/// </value>
|
||||
public string[]? PropertyGroupAliases { get; }
|
||||
|
||||
/// <summary>
|
||||
/// When overridden in a derived class, sets the <see cref="T:System.Runtime.Serialization.SerializationInfo" /> with
|
||||
/// information about the exception.
|
||||
/// </summary>
|
||||
/// <param name="info">
|
||||
/// The <see cref="T:System.Runtime.Serialization.SerializationInfo" /> that holds the serialized object
|
||||
/// data about the exception being thrown.
|
||||
/// </param>
|
||||
/// <param name="context">
|
||||
/// The <see cref="T:System.Runtime.Serialization.StreamingContext" /> that contains contextual
|
||||
/// information about the source or destination.
|
||||
/// </param>
|
||||
/// <exception cref="ArgumentNullException">info</exception>
|
||||
public override void GetObjectData(SerializationInfo info, StreamingContext context)
|
||||
{
|
||||
if (info == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(info));
|
||||
}
|
||||
|
||||
info.AddValue(nameof(ContentTypeAlias), ContentTypeAlias);
|
||||
info.AddValue(nameof(AddedCompositionAlias), AddedCompositionAlias);
|
||||
info.AddValue(nameof(PropertyTypeAliases), PropertyTypeAliases);
|
||||
info.AddValue(nameof(PropertyGroupAliases), PropertyGroupAliases);
|
||||
|
||||
base.GetObjectData(info, context);
|
||||
}
|
||||
|
||||
private static string FormatMessage(string contentTypeAlias, string? addedCompositionAlias, string[] propertyTypeAliases, string[] propertyGroupAliases)
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
|
||||
Reference in New Issue
Block a user