Skip to content

Make InvalidHeaderException serializable #445

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
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
18 changes: 18 additions & 0 deletions src/ICSharpCode.SharpZipLib/Tar/InvalidHeaderException.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
using System;
using System.Runtime.Serialization;

namespace ICSharpCode.SharpZipLib.Tar
{
/// <summary>
/// This exception is used to indicate that there is a problem
/// with a TAR archive header.
/// </summary>
[Serializable]
public class InvalidHeaderException : TarException
{
/// <summary>
Expand Down Expand Up @@ -33,5 +35,21 @@ public InvalidHeaderException(string message, Exception exception)
: base(message, exception)
{
}

/// <summary>
/// Initializes a new instance of the InvalidHeaderException class with serialized data.
/// </summary>
/// <param name="info">
/// The System.Runtime.Serialization.SerializationInfo that holds the serialized
/// object data about the exception being thrown.
/// </param>
/// <param name="context">
/// The System.Runtime.Serialization.StreamingContext that contains contextual information
/// about the source or destination.
/// </param>
protected InvalidHeaderException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public class SerializationTests
[Category("Serialization")]
[TestCase(typeof(BZip2Exception))]
[TestCase(typeof(GZipException))]
[TestCase(typeof(InvalidHeaderException))]
[TestCase(typeof(InvalidNameException))]
[TestCase(typeof(LzwException))]
[TestCase(typeof(SharpZipBaseException))]
Expand Down