0
I’m making an exception in a UWP
, however, it seems that apps UWP
do not have the same resources 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) { }
}
}
There seems to be no attribute [Serializable]
and the guy SerializationInfo
. How to ensure the serialization of the exception in UWP
?
I’m sure you need the
[Serializable]
? What is the purpose of the use? I’m not very familiar with the subject but from what I read (http://answall.com/questions/112335/serialize%C3%A7%C3%A3o-de-exce%C3%A7%C3%B5es) it is not necessary in your scenario.– rubStackOverflow
True, you’re right, in my case it won’t be necessary. I even created the question of the link you posted. I didn’t even remember her anymore. Todo via I think it would be interesting for someone to leave a reply. Bearing in mind that
UWP
is still an unpopular technology and many resources on it is still scarce content, especially in Portuguese.– Matheus Saraiva
UWP does not need this attribute for the custom exception to work.
– Jaedson Barbosa