22
33namespace Asp . Versioning ;
44
5+ using System . ComponentModel ;
56using System . Runtime . Serialization ;
67
78/// <content>
@@ -10,11 +11,23 @@ namespace Asp.Versioning;
1011[ Serializable ]
1112public partial class AmbiguousApiVersionException : Exception
1213{
14+ private const string LegacyFormatterImplMessage = "This API supports obsolete formatter-based serialization. It should not be called or extended by application code." ;
15+ #if NET
16+ private const string LegacyFormatterImplDiagId = "SYSLIB0051" ;
17+ private const string SharedUrlFormat = "https://aka.ms/dotnet-warnings/{0}" ;
18+ #endif
19+
1320 /// <summary>
1421 /// Initializes a new instance of the <see cref="AmbiguousApiVersionException"/> class.
1522 /// </summary>
1623 /// <param name="info">The <see cref="SerializationInfo">serialization info</see> the exception is being deserialized with.</param>
1724 /// <param name="context">The <see cref="StreamingContext">streaming context</see> the exception is being deserialized from.</param>
25+ #if NET
26+ [ Obsolete ( LegacyFormatterImplMessage , DiagnosticId = LegacyFormatterImplDiagId , UrlFormat = SharedUrlFormat ) ]
27+ #else
28+ [ Obsolete ( LegacyFormatterImplMessage ) ]
29+ #endif
30+ [ EditorBrowsable ( EditorBrowsableState . Never ) ]
1831 protected AmbiguousApiVersionException ( SerializationInfo info , StreamingContext context )
1932 : base ( info , context ) => apiVersions = ( string [ ] ) info . GetValue ( nameof ( apiVersions ) , typeof ( string [ ] ) ) ! ;
2033
@@ -23,6 +36,10 @@ protected AmbiguousApiVersionException( SerializationInfo info, StreamingContext
2336 /// </summary>
2437 /// <param name="info">The <see cref="SerializationInfo">serialization info</see> the exception is being serialized with.</param>
2538 /// <param name="context">The <see cref="StreamingContext">streaming context</see> the exception is being serialized in.</param>
39+ #if NET
40+ [ Obsolete ( LegacyFormatterImplMessage , DiagnosticId = LegacyFormatterImplDiagId , UrlFormat = SharedUrlFormat ) ]
41+ #endif
42+ [ EditorBrowsable ( EditorBrowsableState . Never ) ]
2643 public override void GetObjectData ( SerializationInfo info , StreamingContext context )
2744 {
2845 base . GetObjectData ( info , context ) ;
0 commit comments