Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 0 additions & 42 deletions src/Umbraco.Core/Exceptions/DataOperationException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -57,22 +56,6 @@ public DataOperationException(T operation, string message)
: 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>
Expand All @@ -83,29 +66,4 @@ protected DataOperationException(SerializationInfo info, StreamingContext contex
/// 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);
}
}
49 changes: 0 additions & 49 deletions src/Umbraco.Core/Exceptions/InvalidCompositionException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -77,26 +76,6 @@ public InvalidCompositionException(string message, Exception innerException)
{
}

/// <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>
Expand Down Expand Up @@ -129,34 +108,6 @@ protected InvalidCompositionException(SerializationInfo info, StreamingContext c
/// </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();
Expand Down
41 changes: 0 additions & 41 deletions src/Umbraco.Core/Install/InstallException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ namespace Umbraco.Cms.Core.Install;
/// Used for steps to be able to return a JSON structure back to the UI.
/// </summary>
/// <seealso cref="System.Exception" />
[Serializable]
public class InstallException : Exception
{
/// <summary>
Expand Down Expand Up @@ -61,21 +60,6 @@ public InstallException(string message, Exception innerException)
{
}

/// <summary>
/// Initializes a new instance of the <see cref="InstallException" /> 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 InstallException(SerializationInfo info, StreamingContext context)
: base(info, context) =>
View = info.GetString(nameof(View));

/// <summary>
/// Gets the view.
/// </summary>
Expand All @@ -94,29 +78,4 @@ protected InstallException(SerializationInfo info, StreamingContext context)
/// This object is not included when serializing.
/// </remarks>
public object? ViewModel { 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(View), View);

base.GetObjectData(info, context);
}
}
25 changes: 0 additions & 25 deletions src/Umbraco.Core/Semver/Semver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ namespace Umbraco.Cms.Core.Semver
#if NETSTANDARD
public sealed class SemVersion : IComparable<SemVersion>, IComparable
#else
[Serializable]
public sealed class SemVersion : IComparable<SemVersion>, IComparable, ISerializable
#endif
{
Expand All @@ -53,29 +52,6 @@ public sealed class SemVersion : IComparable<SemVersion>, IComparable, ISerializ
RegexOptions.CultureInvariant | RegexOptions.Compiled | RegexOptions.ExplicitCapture);
#endif

#if !NETSTANDARD
/// <summary>
/// Initializes a new instance of the <see cref="SemVersion" /> class.
/// </summary>
/// <param name="info"></param>
/// <param name="context"></param>
/// <exception cref="ArgumentNullException"></exception>
private SemVersion(SerializationInfo info, StreamingContext context)
{
if (info == null)
{
throw new ArgumentNullException("info");
}

SemVersion semVersion = Parse(info.GetString("SemVersion")!);
Major = semVersion.Major;
Minor = semVersion.Minor;
Patch = semVersion.Patch;
Prerelease = semVersion.Prerelease;
Build = semVersion.Build;
}
#endif

/// <summary>
/// Initializes a new instance of the <see cref="SemVersion" /> class.
/// </summary>
Expand Down Expand Up @@ -525,7 +501,6 @@ public override int GetHashCode()
}

#if !NETSTANDARD
[SecurityPermission(SecurityAction.Demand, SerializationFormatter = true)]
public void GetObjectData(SerializationInfo info, StreamingContext context)
{
if (info == null)
Expand Down