I'm creating an exception in UWP
, however, it seems like UWP
apps do not have the same features for serialization as classic applications.
The code below does not work for UWP
.
using System;
using System.Runtime.Serialization;
namespace CustomExceptions
{
[Serializable]
public class InvalidCpfException : Exception
{
public InvalidCpfException ( ) { }
public InvalidCpfException ( string message ) : base(message) { }
public InvalidCpfException ( string message, Exception inner ) : base(message, inner) { }
protected InvalidCpfException ( SerializationInfo info, StreamingContext context ) : base(info, context) { }
}
}
It seems that there is no attribute [Serializable]
and type SerializationInfo
. How to ensure exception serialization in UWP
?