Closed danielmarbach closed 6 years ago
Looking at this a bit more, the above code isn't enough to trigger a warning, however this does:
/// <summary>
/// <see cref="SerializationException(SerializationInfo, StreamingContext)" />
/// </summary>
public class MessageDeserializationException : SerializationException
{
protected MessageDeserializationException(SerializationInfo info, StreamingContext context) : base(info, context)
{
}
}
It's actually the usage of SerializationException
in the xml comment that seems to be causing the warning. As @danielmarbach said, I'm not seeing a reason why this would be flagged, so I think it's a false positive.
These methods to serialize exceptions were throwing PNSE in the past but eventually the fix was backported to 2.0 (see https://github.com/dotnet/platform-compat/issues/76#issuecomment-350378457).
Anyway, the xml thing here is interesting...
In the scope of this issue, we will fix XML problem and version problem is handled in #77.
SerializationException causes warning "PC001 SerializationException.SerializationException(SerializationInfo, StreamingContext) isn't supported on Linux, MacOSX, Windows" when it's in XML:
/// <summary>
/// <see cref="SerializationException(SerializationInfo, StreamingContext)" />
/// </summary>
and does not cause warning when it is in the class body:
static void Main(string[] args)
{
var e = new SerializationException();
}
but it seems to be supported?
https://github.com/dotnet/coreclr/blob/release/2.0.0/src/mscorlib/shared/System/Runtime/Serialization/SerializationException.cs#L35