From a2a3c3e5b9e25ce5de494b71d06caffcf15feed8 Mon Sep 17 00:00:00 2001 From: Shad Storhaug Date: Thu, 24 Oct 2024 00:35:51 +0700 Subject: [PATCH] SWEEP: Marked all serialization constructors and GetObjectData() methods obsolete and hidden from the IDE. Also suppressed related build warnings, since we are doing this on all target frameworks. (fixes #983) --- Directory.Build.targets | 4 ++++ .../ByTask/Feeds/NoMoreDataException.cs | 4 ++++ src/Lucene.Net.Benchmark/Support/Sax/SAXException.cs | 8 ++++++++ .../Support/Sax/SAXNotRecognizedException.cs | 3 +++ .../Support/Sax/SAXNotSupportedException.cs | 3 +++ .../Support/Sax/SAXParseException.cs | 7 +++++++ src/Lucene.Net.Expressions/JS/JavascriptLexer.cs | 3 --- .../Highlight/InvalidTokenOffsetsException.cs | 5 ++++- .../Function/DocValues/DocTermsIndexDocValues.cs | 5 ++++- src/Lucene.Net.QueryParser/Classic/ParseException.cs | 9 ++++++++- src/Lucene.Net.QueryParser/Classic/QueryParser.cs | 5 ++++- src/Lucene.Net.QueryParser/Classic/QueryParserBase.cs | 3 +++ src/Lucene.Net.QueryParser/Classic/TokenMgrError.cs | 9 ++++++++- .../Flexible/Core/QueryNodeError.cs | 3 +++ .../Flexible/Core/QueryNodeException.cs | 3 +++ .../Flexible/Core/QueryNodeParseException.cs | 7 +++++++ .../Flexible/Standard/Parser/ParseException.cs | 7 +++++++ .../Flexible/Standard/Parser/StandardSyntaxParser.cs | 3 +++ .../Flexible/Standard/Parser/TokenMgrError.cs | 7 +++++++ .../Surround/Parser/ParseException.cs | 9 ++++++++- .../Surround/Parser/QueryParser.cs | 3 +++ .../Surround/Parser/TokenMgrError.cs | 9 ++++++++- .../Surround/Query/TooManyBasicQueries.cs | 3 +++ src/Lucene.Net.QueryParser/Xml/ParserException.cs | 3 +++ src/Lucene.Net.Replicator/SessionExpiredException.cs | 7 +++++-- .../Query/UnsupportedSpatialOperation.cs | 3 +++ .../Search/ShardSearchingTestBase.cs | 5 ++++- .../Store/MockDirectoryWrapper.cs | 3 +++ src/Lucene.Net/Index/CorruptIndexException.cs | 7 +++++-- src/Lucene.Net/Index/IndexFormatTooNewException.cs | 6 +++++- src/Lucene.Net/Index/IndexFormatTooOldException.cs | 6 +++++- src/Lucene.Net/Index/IndexNotFoundException.cs | 7 +++++-- src/Lucene.Net/Index/MergePolicy.cs | 5 +++++ src/Lucene.Net/Index/TwoPhaseCommitTool.cs | 7 ++++++- src/Lucene.Net/Search/BooleanQuery.cs | 6 +++++- src/Lucene.Net/Search/CollectionTerminatedException.cs | 6 +++++- src/Lucene.Net/Search/TimeLimitingCollector.cs | 10 +++++++++- src/Lucene.Net/Store/AlreadyClosedException.cs | 5 ++++- src/Lucene.Net/Store/LockObtainFailedException.cs | 7 +++++-- src/Lucene.Net/Store/LockReleaseFailedException.cs | 7 +++++-- .../Support/Diagnostics/AssertionException.cs | 4 ++++ .../Support/ExceptionHandling/Errors/AssertionError.cs | 3 +++ .../Support/ExceptionHandling/Errors/Error.cs | 3 +++ .../ExceptionHandling/Errors/NoClassDefFoundError.cs | 3 +++ .../ExceptionHandling/Errors/OutOfMemoryError.cs | 3 +++ .../Errors/ServiceConfigurationError.cs | 3 +++ .../ExceptionHandling/Errors/StackOverflowError.cs | 3 +++ .../Exceptions/ClassNotFoundException.cs | 3 +++ .../Exceptions/IOExceptions/AlreadyClosedException.cs | 3 +++ .../Exceptions/IOExceptions/EOFException.cs | 3 +++ .../Exceptions/NoSuchMethodException.cs | 3 +++ .../ArrayIndexOutOfBoundsException.cs | 3 +++ .../RuntimeExceptions/IllegalArgumentException.cs | 3 +++ .../RuntimeExceptions/IllegalStateException.cs | 3 +++ .../RuntimeExceptions/IndexOutOfBoundsException.cs | 3 +++ .../RuntimeExceptions/NullPointerException.cs | 3 +++ .../RuntimeExceptions/NumberFormatException.cs | 3 +++ .../Exceptions/RuntimeExceptions/RuntimeException.cs | 3 +++ .../StringIndexOutOfBoundsException.cs | 3 +++ .../RuntimeExceptions/UnsupportedOperationException.cs | 3 +++ .../ExceptionHandling/Exceptions/ServletException.cs | 3 +++ src/Lucene.Net/Support/Util/LuceneSystemException.cs | 3 +++ src/Lucene.Net/Util/BytesRefHash.cs | 5 ++++- src/Lucene.Net/Util/SetOnce.cs | 5 ++++- src/Lucene.Net/Util/ThreadInterruptedException.cs | 4 ++++ 65 files changed, 273 insertions(+), 30 deletions(-) diff --git a/Directory.Build.targets b/Directory.Build.targets index a945a4157f..b1d0087fb5 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -22,6 +22,10 @@ + + $(NoWarn);SYSLIB0051 + + $(AlternatePublishRootDirectory)/$(TargetFramework)/$(MSBuildProjectName)/ diff --git a/src/Lucene.Net.Benchmark/ByTask/Feeds/NoMoreDataException.cs b/src/Lucene.Net.Benchmark/ByTask/Feeds/NoMoreDataException.cs index 7d29dbc7d5..19a578007e 100644 --- a/src/Lucene.Net.Benchmark/ByTask/Feeds/NoMoreDataException.cs +++ b/src/Lucene.Net.Benchmark/ByTask/Feeds/NoMoreDataException.cs @@ -1,5 +1,7 @@ using System; + #if FEATURE_SERIALIZABLE_EXCEPTIONS +using System.ComponentModel; using System.Runtime.Serialization; #endif @@ -43,6 +45,8 @@ public NoMoreDataException() /// /// The that holds the serialized object data about the exception being thrown. /// The that contains contextual information about the source or destination. + [Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.")] + [EditorBrowsable(EditorBrowsableState.Never)] protected NoMoreDataException(SerializationInfo info, StreamingContext context) : base(info, context) { diff --git a/src/Lucene.Net.Benchmark/Support/Sax/SAXException.cs b/src/Lucene.Net.Benchmark/Support/Sax/SAXException.cs index 0279d1b8df..b868f9c878 100644 --- a/src/Lucene.Net.Benchmark/Support/Sax/SAXException.cs +++ b/src/Lucene.Net.Benchmark/Support/Sax/SAXException.cs @@ -4,7 +4,9 @@ // $Id: SAXException.java,v 1.7 2002/01/30 21:13:48 dbrownell Exp $ using System; + #if FEATURE_SERIALIZABLE_EXCEPTIONS +using System.ComponentModel; using System.Runtime.Serialization; #endif #if FEATURE_CODE_ACCESS_SECURITY @@ -98,6 +100,8 @@ public SAXException(string message, Exception e) /// /// The that holds the serialized object data about the exception being thrown. /// The that contains contextual information about the source or destination. + [Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.")] + [EditorBrowsable(EditorBrowsableState.Never)] protected SAXException(SerializationInfo info, StreamingContext context) : base(info, context) { @@ -107,7 +111,11 @@ protected SAXException(SerializationInfo info, StreamingContext context) #if FEATURE_CODE_ACCESS_SECURITY [SecurityPermission(SecurityAction.Demand, SerializationFormatter = true)] #endif + [Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.")] + [EditorBrowsable(EditorBrowsableState.Never)] +#pragma warning disable CS0809 // Obsolete member overrides non-obsolete member public override void GetObjectData(SerializationInfo info, StreamingContext context) +#pragma warning restore CS0809 // Obsolete member overrides non-obsolete member { base.GetObjectData(info, context); info.AddValue("Exception", exception, typeof(Exception)); diff --git a/src/Lucene.Net.Benchmark/Support/Sax/SAXNotRecognizedException.cs b/src/Lucene.Net.Benchmark/Support/Sax/SAXNotRecognizedException.cs index 205ce11009..69d754f0c6 100644 --- a/src/Lucene.Net.Benchmark/Support/Sax/SAXNotRecognizedException.cs +++ b/src/Lucene.Net.Benchmark/Support/Sax/SAXNotRecognizedException.cs @@ -6,6 +6,7 @@ using System; #if FEATURE_SERIALIZABLE_EXCEPTIONS +using System.ComponentModel; using System.Runtime.Serialization; #endif @@ -58,6 +59,8 @@ public SAXNotRecognizedException(string message) /// /// The that holds the serialized object data about the exception being thrown. /// The that contains contextual information about the source or destination. + [Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.")] + [EditorBrowsable(EditorBrowsableState.Never)] protected SAXNotRecognizedException(SerializationInfo info, StreamingContext context) : base(info, context) { diff --git a/src/Lucene.Net.Benchmark/Support/Sax/SAXNotSupportedException.cs b/src/Lucene.Net.Benchmark/Support/Sax/SAXNotSupportedException.cs index 3c0143146c..967234adc4 100644 --- a/src/Lucene.Net.Benchmark/Support/Sax/SAXNotSupportedException.cs +++ b/src/Lucene.Net.Benchmark/Support/Sax/SAXNotSupportedException.cs @@ -6,6 +6,7 @@ using System; #if FEATURE_SERIALIZABLE_EXCEPTIONS +using System.ComponentModel; using System.Runtime.Serialization; #endif @@ -59,6 +60,8 @@ public SAXNotSupportedException(string message) /// /// The that holds the serialized object data about the exception being thrown. /// The that contains contextual information about the source or destination. + [Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.")] + [EditorBrowsable(EditorBrowsableState.Never)] protected SAXNotSupportedException(SerializationInfo info, StreamingContext context) : base(info, context) { diff --git a/src/Lucene.Net.Benchmark/Support/Sax/SAXParseException.cs b/src/Lucene.Net.Benchmark/Support/Sax/SAXParseException.cs index 3af7b456af..0ddb1000df 100644 --- a/src/Lucene.Net.Benchmark/Support/Sax/SAXParseException.cs +++ b/src/Lucene.Net.Benchmark/Support/Sax/SAXParseException.cs @@ -5,6 +5,7 @@ using System; #if FEATURE_SERIALIZABLE_EXCEPTIONS +using System.ComponentModel; using System.Runtime.Serialization; #endif #if FEATURE_CODE_ACCESS_SECURITY @@ -170,6 +171,8 @@ internal SAXParseException(string message) /// /// The that holds the serialized object data about the exception being thrown. /// The that contains contextual information about the source or destination. + [Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.")] + [EditorBrowsable(EditorBrowsableState.Never)] protected SAXParseException(SerializationInfo info, StreamingContext context) : base(info, context) { @@ -182,7 +185,11 @@ protected SAXParseException(SerializationInfo info, StreamingContext context) #if FEATURE_CODE_ACCESS_SECURITY [SecurityPermission(SecurityAction.Demand, SerializationFormatter = true)] #endif + [Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.")] + [EditorBrowsable(EditorBrowsableState.Never)] +#pragma warning disable CS0809 // Obsolete member overrides non-obsolete member public override void GetObjectData(SerializationInfo info, StreamingContext context) +#pragma warning restore CS0809 // Obsolete member overrides non-obsolete member { base.GetObjectData(info, context); info.AddValue("publicId", publicId, typeof(string)); diff --git a/src/Lucene.Net.Expressions/JS/JavascriptLexer.cs b/src/Lucene.Net.Expressions/JS/JavascriptLexer.cs index 4d83f549df..60c68aea74 100644 --- a/src/Lucene.Net.Expressions/JS/JavascriptLexer.cs +++ b/src/Lucene.Net.Expressions/JS/JavascriptLexer.cs @@ -22,9 +22,6 @@ // ANTLR GENERATED CODE: DO NOT EDIT (LUCENENET: Not really auto generated in the port) using System; -#if FEATURE_SERIALIZABLE_EXCEPTIONS -using System.Runtime.Serialization; -#endif using Antlr.Runtime; using J2N.Text; using Lucene.Net.Support; diff --git a/src/Lucene.Net.Highlighter/Highlight/InvalidTokenOffsetsException.cs b/src/Lucene.Net.Highlighter/Highlight/InvalidTokenOffsetsException.cs index 92e60f1019..e33771fbd0 100644 --- a/src/Lucene.Net.Highlighter/Highlight/InvalidTokenOffsetsException.cs +++ b/src/Lucene.Net.Highlighter/Highlight/InvalidTokenOffsetsException.cs @@ -1,5 +1,6 @@ using System; #if FEATURE_SERIALIZABLE_EXCEPTIONS +using System.ComponentModel; using System.Runtime.Serialization; #endif @@ -50,10 +51,12 @@ public InvalidTokenOffsetsException(string message, Exception inner) : base(mess /// /// The that holds the serialized object data about the exception being thrown. /// The that contains contextual information about the source or destination. + [Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.")] + [EditorBrowsable(EditorBrowsableState.Never)] protected InvalidTokenOffsetsException(SerializationInfo info, StreamingContext context) : base(info, context) { } #endif } -} \ No newline at end of file +} diff --git a/src/Lucene.Net.Queries/Function/DocValues/DocTermsIndexDocValues.cs b/src/Lucene.Net.Queries/Function/DocValues/DocTermsIndexDocValues.cs index 2c2af7fc91..6e1d50d6f5 100644 --- a/src/Lucene.Net.Queries/Function/DocValues/DocTermsIndexDocValues.cs +++ b/src/Lucene.Net.Queries/Function/DocValues/DocTermsIndexDocValues.cs @@ -5,6 +5,7 @@ using Lucene.Net.Util.Mutable; using System; #if FEATURE_SERIALIZABLE_EXCEPTIONS +using System.ComponentModel; using System.Runtime.Serialization; #endif @@ -185,6 +186,8 @@ internal DocTermsIndexException(string message) /// /// The that holds the serialized object data about the exception being thrown. /// The that contains contextual information about the source or destination. + [Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.")] + [EditorBrowsable(EditorBrowsableState.Never)] private DocTermsIndexException(SerializationInfo info, StreamingContext context) : base(info, context) { @@ -192,4 +195,4 @@ private DocTermsIndexException(SerializationInfo info, StreamingContext context) #endif } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net.QueryParser/Classic/ParseException.cs b/src/Lucene.Net.QueryParser/Classic/ParseException.cs index 713056241f..f637bbe68f 100644 --- a/src/Lucene.Net.QueryParser/Classic/ParseException.cs +++ b/src/Lucene.Net.QueryParser/Classic/ParseException.cs @@ -2,6 +2,7 @@ using System; using System.Diagnostics.CodeAnalysis; #if FEATURE_SERIALIZABLE_EXCEPTIONS +using System.ComponentModel; using System.Runtime.Serialization; #endif #if FEATURE_CODE_ACCESS_SECURITY @@ -87,6 +88,8 @@ public ParseException(string message, Exception innerException) /// /// The that holds the serialized object data about the exception being thrown. /// The that contains contextual information about the source or destination. + [Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.")] + [EditorBrowsable(EditorBrowsableState.Never)] protected ParseException(SerializationInfo info, StreamingContext context) : base(info, context) { @@ -98,7 +101,11 @@ protected ParseException(SerializationInfo info, StreamingContext context) #if FEATURE_CODE_ACCESS_SECURITY [SecurityPermission(SecurityAction.Demand, SerializationFormatter = true)] #endif + [Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.")] + [EditorBrowsable(EditorBrowsableState.Never)] +#pragma warning disable CS0809 // Obsolete member overrides non-obsolete member public override void GetObjectData(SerializationInfo info, StreamingContext context) +#pragma warning restore CS0809 // Obsolete member overrides non-obsolete member { base.GetObjectData(info, context); info.AddValue("CurrentToken", CurrentToken, typeof(Token)); @@ -265,4 +272,4 @@ internal static string AddEscapes(string str) return retval.ToString(); } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net.QueryParser/Classic/QueryParser.cs b/src/Lucene.Net.QueryParser/Classic/QueryParser.cs index 8bfaa1179c..c87d0acbc5 100644 --- a/src/Lucene.Net.QueryParser/Classic/QueryParser.cs +++ b/src/Lucene.Net.QueryParser/Classic/QueryParser.cs @@ -5,6 +5,7 @@ using System.Collections.Generic; using System.IO; #if FEATURE_SERIALIZABLE_EXCEPTIONS +using System.ComponentModel; using System.Runtime.Serialization; #endif using JCG = J2N.Collections.Generic; @@ -731,6 +732,8 @@ public LookaheadSuccess() /// /// The that holds the serialized object data about the exception being thrown. /// The that contains contextual information about the source or destination. + [Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.")] + [EditorBrowsable(EditorBrowsableState.Never)] public LookaheadSuccess(SerializationInfo info, StreamingContext context) : base(info, context) { @@ -961,4 +964,4 @@ internal sealed class JJCalls internal JJCalls next; } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net.QueryParser/Classic/QueryParserBase.cs b/src/Lucene.Net.QueryParser/Classic/QueryParserBase.cs index 9df183818f..283ff34cb4 100644 --- a/src/Lucene.Net.QueryParser/Classic/QueryParserBase.cs +++ b/src/Lucene.Net.QueryParser/Classic/QueryParserBase.cs @@ -13,6 +13,7 @@ using System.Globalization; using System.IO; #if FEATURE_SERIALIZABLE_EXCEPTIONS +using System.ComponentModel; using System.Runtime.Serialization; #endif using System.Text; @@ -73,6 +74,8 @@ public MethodRemovedUseAnother() /// /// The that holds the serialized object data about the exception being thrown. /// The that contains contextual information about the source or destination. + [Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.")] + [EditorBrowsable(EditorBrowsableState.Never)] protected MethodRemovedUseAnother(SerializationInfo info, StreamingContext context) : base(info, context) { diff --git a/src/Lucene.Net.QueryParser/Classic/TokenMgrError.cs b/src/Lucene.Net.QueryParser/Classic/TokenMgrError.cs index 5214424df5..a5155c2f37 100644 --- a/src/Lucene.Net.QueryParser/Classic/TokenMgrError.cs +++ b/src/Lucene.Net.QueryParser/Classic/TokenMgrError.cs @@ -1,5 +1,6 @@ using System; #if FEATURE_SERIALIZABLE_EXCEPTIONS +using System.ComponentModel; using System.Runtime.Serialization; #endif #if FEATURE_CODE_ACCESS_SECURITY @@ -180,6 +181,8 @@ public TokenMgrError(bool eofSeen, int lexState, int errorLine, int errorColumn, /// /// The that holds the serialized object data about the exception being thrown. /// The that contains contextual information about the source or destination. + [Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.")] + [EditorBrowsable(EditorBrowsableState.Never)] protected TokenMgrError(SerializationInfo info, StreamingContext context) : base(info, context) { @@ -189,11 +192,15 @@ protected TokenMgrError(SerializationInfo info, StreamingContext context) #if FEATURE_CODE_ACCESS_SECURITY [SecurityPermission(SecurityAction.Demand, SerializationFormatter = true)] #endif + [Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.")] + [EditorBrowsable(EditorBrowsableState.Never)] +#pragma warning disable CS0809 // Obsolete member overrides non-obsolete member public override void GetObjectData(SerializationInfo info, StreamingContext context) +#pragma warning restore CS0809 // Obsolete member overrides non-obsolete member { base.GetObjectData(info, context); info.AddValue("errorCode", errorCode, typeof(int)); } #endif } -} \ No newline at end of file +} diff --git a/src/Lucene.Net.QueryParser/Flexible/Core/QueryNodeError.cs b/src/Lucene.Net.QueryParser/Flexible/Core/QueryNodeError.cs index b02e2d1c09..76520b3d8a 100644 --- a/src/Lucene.Net.QueryParser/Flexible/Core/QueryNodeError.cs +++ b/src/Lucene.Net.QueryParser/Flexible/Core/QueryNodeError.cs @@ -1,5 +1,6 @@ using System; #if FEATURE_SERIALIZABLE_EXCEPTIONS +using System.ComponentModel; using System.Runtime.Serialization; #endif #nullable enable @@ -103,6 +104,8 @@ public QueryNodeError(string? message, Exception? innerException) /// /// The that holds the serialized object data about the exception being thrown. /// The that contains contextual information about the source or destination. + [Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.")] + [EditorBrowsable(EditorBrowsableState.Never)] protected QueryNodeError(SerializationInfo info, StreamingContext context) : base(info, context) { diff --git a/src/Lucene.Net.QueryParser/Flexible/Core/QueryNodeException.cs b/src/Lucene.Net.QueryParser/Flexible/Core/QueryNodeException.cs index fec0003551..59f22aa3d7 100644 --- a/src/Lucene.Net.QueryParser/Flexible/Core/QueryNodeException.cs +++ b/src/Lucene.Net.QueryParser/Flexible/Core/QueryNodeException.cs @@ -1,5 +1,6 @@ using System; #if FEATURE_SERIALIZABLE_EXCEPTIONS +using System.ComponentModel; using System.Runtime.Serialization; #endif #nullable enable @@ -76,6 +77,8 @@ public QueryNodeException(string? message, Exception? innerException) /// /// The that holds the serialized object data about the exception being thrown. /// The that contains contextual information about the source or destination. + [Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.")] + [EditorBrowsable(EditorBrowsableState.Never)] protected QueryNodeException(SerializationInfo info, StreamingContext context) : base(info, context) { diff --git a/src/Lucene.Net.QueryParser/Flexible/Core/QueryNodeParseException.cs b/src/Lucene.Net.QueryParser/Flexible/Core/QueryNodeParseException.cs index d48755fff1..1beb1153a2 100644 --- a/src/Lucene.Net.QueryParser/Flexible/Core/QueryNodeParseException.cs +++ b/src/Lucene.Net.QueryParser/Flexible/Core/QueryNodeParseException.cs @@ -1,5 +1,6 @@ using System; #if FEATURE_SERIALIZABLE_EXCEPTIONS +using System.ComponentModel; using System.Runtime.Serialization; #endif #if FEATURE_CODE_ACCESS_SECURITY @@ -82,6 +83,8 @@ public QueryNodeParseException(string? message, Exception? innerException) /// /// The that holds the serialized object data about the exception being thrown. /// The that contains contextual information about the source or destination. + [Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.")] + [EditorBrowsable(EditorBrowsableState.Never)] protected QueryNodeParseException(SerializationInfo info, StreamingContext context) : base(info, context) { @@ -94,7 +97,11 @@ protected QueryNodeParseException(SerializationInfo info, StreamingContext conte #if FEATURE_CODE_ACCESS_SECURITY [SecurityPermission(SecurityAction.Demand, SerializationFormatter = true)] #endif + [Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.")] + [EditorBrowsable(EditorBrowsableState.Never)] +#pragma warning disable CS0809 // Obsolete member overrides non-obsolete member public override void GetObjectData(SerializationInfo info, StreamingContext context) +#pragma warning restore CS0809 // Obsolete member overrides non-obsolete member { base.GetObjectData(info, context); info.AddValue("query", query, typeof(string)); diff --git a/src/Lucene.Net.QueryParser/Flexible/Standard/Parser/ParseException.cs b/src/Lucene.Net.QueryParser/Flexible/Standard/Parser/ParseException.cs index a909e5502b..45b34dbd5e 100644 --- a/src/Lucene.Net.QueryParser/Flexible/Standard/Parser/ParseException.cs +++ b/src/Lucene.Net.QueryParser/Flexible/Standard/Parser/ParseException.cs @@ -5,6 +5,7 @@ using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; #if FEATURE_SERIALIZABLE_EXCEPTIONS +using System.ComponentModel; using System.Runtime.Serialization; #endif #if FEATURE_CODE_ACCESS_SECURITY @@ -102,6 +103,8 @@ public ParseException(string? message, Exception? innerException) /// /// The that holds the serialized object data about the exception being thrown. /// The that contains contextual information about the source or destination. + [Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.")] + [EditorBrowsable(EditorBrowsableState.Never)] protected ParseException(SerializationInfo info, StreamingContext context) : base(info, context) { @@ -113,7 +116,11 @@ protected ParseException(SerializationInfo info, StreamingContext context) #if FEATURE_CODE_ACCESS_SECURITY [SecurityPermission(SecurityAction.Demand, SerializationFormatter = true)] #endif + [Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.")] + [EditorBrowsable(EditorBrowsableState.Never)] +#pragma warning disable CS0809 // Obsolete member overrides non-obsolete member public override void GetObjectData(SerializationInfo info, StreamingContext context) +#pragma warning restore CS0809 // Obsolete member overrides non-obsolete member { base.GetObjectData(info, context); info.AddValue("CurrentToken", CurrentToken, typeof(Token)); diff --git a/src/Lucene.Net.QueryParser/Flexible/Standard/Parser/StandardSyntaxParser.cs b/src/Lucene.Net.QueryParser/Flexible/Standard/Parser/StandardSyntaxParser.cs index 866caf814e..148b25ebe7 100644 --- a/src/Lucene.Net.QueryParser/Flexible/Standard/Parser/StandardSyntaxParser.cs +++ b/src/Lucene.Net.QueryParser/Flexible/Standard/Parser/StandardSyntaxParser.cs @@ -9,6 +9,7 @@ using System.Globalization; using System.IO; #if FEATURE_SERIALIZABLE_EXCEPTIONS +using System.ComponentModel; using System.Runtime.Serialization; #endif using JCG = J2N.Collections.Generic; @@ -1094,6 +1095,8 @@ public LookaheadSuccess() /// /// The that holds the serialized object data about the exception being thrown. /// The that contains contextual information about the source or destination. + [Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.")] + [EditorBrowsable(EditorBrowsableState.Never)] public LookaheadSuccess(SerializationInfo info, StreamingContext context) : base(info, context) { diff --git a/src/Lucene.Net.QueryParser/Flexible/Standard/Parser/TokenMgrError.cs b/src/Lucene.Net.QueryParser/Flexible/Standard/Parser/TokenMgrError.cs index 2c344d53b5..a7cb83d382 100644 --- a/src/Lucene.Net.QueryParser/Flexible/Standard/Parser/TokenMgrError.cs +++ b/src/Lucene.Net.QueryParser/Flexible/Standard/Parser/TokenMgrError.cs @@ -1,6 +1,7 @@ using J2N; using System; #if FEATURE_SERIALIZABLE_EXCEPTIONS +using System.ComponentModel; using System.Runtime.Serialization; #endif #if FEATURE_CODE_ACCESS_SECURITY @@ -183,6 +184,8 @@ public TokenMgrError(bool eofSeen, int lexState, int errorLine, int errorColumn, /// /// The that holds the serialized object data about the exception being thrown. /// The that contains contextual information about the source or destination. + [Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.")] + [EditorBrowsable(EditorBrowsableState.Never)] protected TokenMgrError(SerializationInfo info, StreamingContext context) : base(info, context) { @@ -192,7 +195,11 @@ protected TokenMgrError(SerializationInfo info, StreamingContext context) #if FEATURE_CODE_ACCESS_SECURITY [SecurityPermission(SecurityAction.Demand, SerializationFormatter = true)] #endif + [Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.")] + [EditorBrowsable(EditorBrowsableState.Never)] +#pragma warning disable CS0809 // Obsolete member overrides non-obsolete member public override void GetObjectData(SerializationInfo info, StreamingContext context) +#pragma warning restore CS0809 // Obsolete member overrides non-obsolete member { base.GetObjectData(info, context); info.AddValue("errorCode", errorCode, typeof(int)); diff --git a/src/Lucene.Net.QueryParser/Surround/Parser/ParseException.cs b/src/Lucene.Net.QueryParser/Surround/Parser/ParseException.cs index 2c07f9d4a5..cf09eb095e 100644 --- a/src/Lucene.Net.QueryParser/Surround/Parser/ParseException.cs +++ b/src/Lucene.Net.QueryParser/Surround/Parser/ParseException.cs @@ -2,6 +2,7 @@ using System; using System.Diagnostics.CodeAnalysis; #if FEATURE_SERIALIZABLE_EXCEPTIONS +using System.ComponentModel; using System.Runtime.Serialization; #endif #if FEATURE_CODE_ACCESS_SECURITY @@ -87,6 +88,8 @@ public ParseException(string message, Exception innerException) /// /// The that holds the serialized object data about the exception being thrown. /// The that contains contextual information about the source or destination. + [Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.")] + [EditorBrowsable(EditorBrowsableState.Never)] protected ParseException(SerializationInfo info, StreamingContext context) : base(info, context) { @@ -98,7 +101,11 @@ protected ParseException(SerializationInfo info, StreamingContext context) #if FEATURE_CODE_ACCESS_SECURITY [SecurityPermission(SecurityAction.Demand, SerializationFormatter = true)] #endif + [Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.")] + [EditorBrowsable(EditorBrowsableState.Never)] +#pragma warning disable CS0809 // Obsolete member overrides non-obsolete member public override void GetObjectData(SerializationInfo info, StreamingContext context) +#pragma warning restore CS0809 // Obsolete member overrides non-obsolete member { base.GetObjectData(info, context); info.AddValue("CurrentToken", CurrentToken, typeof(Token)); @@ -265,4 +272,4 @@ internal static string AddEscapes(string str) return retval.ToString(); } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net.QueryParser/Surround/Parser/QueryParser.cs b/src/Lucene.Net.QueryParser/Surround/Parser/QueryParser.cs index cbb86037c2..36c511ee06 100644 --- a/src/Lucene.Net.QueryParser/Surround/Parser/QueryParser.cs +++ b/src/Lucene.Net.QueryParser/Surround/Parser/QueryParser.cs @@ -4,6 +4,7 @@ using System.Diagnostics.CodeAnalysis; using System.IO; #if FEATURE_SERIALIZABLE_EXCEPTIONS +using System.ComponentModel; using System.Runtime.Serialization; #endif using JCG = J2N.Collections.Generic; @@ -708,6 +709,8 @@ public LookaheadSuccess() /// /// The that holds the serialized object data about the exception being thrown. /// The that contains contextual information about the source or destination. + [Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.")] + [EditorBrowsable(EditorBrowsableState.Never)] public LookaheadSuccess(SerializationInfo info, StreamingContext context) : base(info, context) { diff --git a/src/Lucene.Net.QueryParser/Surround/Parser/TokenMgrError.cs b/src/Lucene.Net.QueryParser/Surround/Parser/TokenMgrError.cs index 27fb4bbbcd..40a939807e 100644 --- a/src/Lucene.Net.QueryParser/Surround/Parser/TokenMgrError.cs +++ b/src/Lucene.Net.QueryParser/Surround/Parser/TokenMgrError.cs @@ -1,5 +1,6 @@ using System; #if FEATURE_SERIALIZABLE_EXCEPTIONS +using System.ComponentModel; using System.Runtime.Serialization; #endif #if FEATURE_CODE_ACCESS_SECURITY @@ -180,6 +181,8 @@ public TokenMgrError(bool EOFSeen, int lexState, int errorLine, int errorColumn, /// /// The that holds the serialized object data about the exception being thrown. /// The that contains contextual information about the source or destination. + [Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.")] + [EditorBrowsable(EditorBrowsableState.Never)] protected TokenMgrError(SerializationInfo info, StreamingContext context) : base(info, context) { @@ -189,11 +192,15 @@ protected TokenMgrError(SerializationInfo info, StreamingContext context) #if FEATURE_CODE_ACCESS_SECURITY [SecurityPermission(SecurityAction.Demand, SerializationFormatter = true)] #endif + [Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.")] + [EditorBrowsable(EditorBrowsableState.Never)] +#pragma warning disable CS0809 // Obsolete member overrides non-obsolete member public override void GetObjectData(SerializationInfo info, StreamingContext context) +#pragma warning restore CS0809 // Obsolete member overrides non-obsolete member { base.GetObjectData(info, context); info.AddValue("errorCode", errorCode, typeof(int)); } #endif } -} \ No newline at end of file +} diff --git a/src/Lucene.Net.QueryParser/Surround/Query/TooManyBasicQueries.cs b/src/Lucene.Net.QueryParser/Surround/Query/TooManyBasicQueries.cs index 0f5c6df9ab..a2d86384fc 100644 --- a/src/Lucene.Net.QueryParser/Surround/Query/TooManyBasicQueries.cs +++ b/src/Lucene.Net.QueryParser/Surround/Query/TooManyBasicQueries.cs @@ -1,6 +1,7 @@ using System; using System.IO; #if FEATURE_SERIALIZABLE_EXCEPTIONS +using System.ComponentModel; using System.Runtime.Serialization; #endif @@ -50,6 +51,8 @@ internal TooManyBasicQueries(string message) /// /// The that holds the serialized object data about the exception being thrown. /// The that contains contextual information about the source or destination. + [Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.")] + [EditorBrowsable(EditorBrowsableState.Never)] protected TooManyBasicQueries(SerializationInfo info, StreamingContext context) : base(info, context) { diff --git a/src/Lucene.Net.QueryParser/Xml/ParserException.cs b/src/Lucene.Net.QueryParser/Xml/ParserException.cs index e1c9bf7b9d..90e5977ef6 100644 --- a/src/Lucene.Net.QueryParser/Xml/ParserException.cs +++ b/src/Lucene.Net.QueryParser/Xml/ParserException.cs @@ -1,5 +1,6 @@ using System; #if FEATURE_SERIALIZABLE_EXCEPTIONS +using System.ComponentModel; using System.Runtime.Serialization; #endif @@ -59,6 +60,8 @@ public ParserException(Exception cause) /// /// The that holds the serialized object data about the exception being thrown. /// The that contains contextual information about the source or destination. + [Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.")] + [EditorBrowsable(EditorBrowsableState.Never)] protected ParserException(SerializationInfo info, StreamingContext context) : base(info, context) { diff --git a/src/Lucene.Net.Replicator/SessionExpiredException.cs b/src/Lucene.Net.Replicator/SessionExpiredException.cs index 74fbf45247..5ce4e5b8ed 100644 --- a/src/Lucene.Net.Replicator/SessionExpiredException.cs +++ b/src/Lucene.Net.Replicator/SessionExpiredException.cs @@ -1,6 +1,7 @@ -using System; +using System; using System.IO; #if FEATURE_SERIALIZABLE_EXCEPTIONS +using System.ComponentModel; using System.Runtime.Serialization; #endif @@ -65,10 +66,12 @@ public SessionExpiredException(string message, Exception inner) /// /// The that holds the serialized object data about the exception being thrown. /// The that contains contextual information about the source or destination. + [Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.")] + [EditorBrowsable(EditorBrowsableState.Never)] protected SessionExpiredException(SerializationInfo info, StreamingContext context) : base(info, context) { } #endif } -} \ No newline at end of file +} diff --git a/src/Lucene.Net.Spatial/Query/UnsupportedSpatialOperation.cs b/src/Lucene.Net.Spatial/Query/UnsupportedSpatialOperation.cs index 9e1c57d751..3065352d65 100644 --- a/src/Lucene.Net.Spatial/Query/UnsupportedSpatialOperation.cs +++ b/src/Lucene.Net.Spatial/Query/UnsupportedSpatialOperation.cs @@ -1,5 +1,6 @@ using System; #if FEATURE_SERIALIZABLE_EXCEPTIONS +using System.ComponentModel; using System.Runtime.Serialization; #endif @@ -51,6 +52,8 @@ internal UnsupportedSpatialOperationException(string? message) /// /// The that holds the serialized object data about the exception being thrown. /// The that contains contextual information about the source or destination. + [Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.")] + [EditorBrowsable(EditorBrowsableState.Never)] protected UnsupportedSpatialOperationException(SerializationInfo info, StreamingContext context) : base(info, context) { diff --git a/src/Lucene.Net.TestFramework/Search/ShardSearchingTestBase.cs b/src/Lucene.Net.TestFramework/Search/ShardSearchingTestBase.cs index 4d81ee3597..17a9701237 100644 --- a/src/Lucene.Net.TestFramework/Search/ShardSearchingTestBase.cs +++ b/src/Lucene.Net.TestFramework/Search/ShardSearchingTestBase.cs @@ -14,6 +14,7 @@ using JCG = J2N.Collections.Generic; using Console = Lucene.Net.Util.SystemConsole; #if FEATURE_SERIALIZABLE_EXCEPTIONS +using System.ComponentModel; using System.Runtime.Serialization; #endif @@ -58,6 +59,8 @@ public SearcherExpiredException(string message) /// /// The that holds the serialized object data about the exception being thrown. /// The that contains contextual information about the source or destination. + [Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.")] + [EditorBrowsable(EditorBrowsableState.Never)] protected SearcherExpiredException(SerializationInfo info, StreamingContext context) : base(info, context) { @@ -810,4 +813,4 @@ public SearcherAndVersion(IndexSearcher searcher, long version) } } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net.TestFramework/Store/MockDirectoryWrapper.cs b/src/Lucene.Net.TestFramework/Store/MockDirectoryWrapper.cs index 0c756b4b7c..a9ea7e00e1 100644 --- a/src/Lucene.Net.TestFramework/Store/MockDirectoryWrapper.cs +++ b/src/Lucene.Net.TestFramework/Store/MockDirectoryWrapper.cs @@ -17,6 +17,7 @@ using Console = Lucene.Net.Util.SystemConsole; using JCG = J2N.Collections.Generic; #if FEATURE_SERIALIZABLE_EXCEPTIONS +using System.ComponentModel; using System.Runtime.Serialization; #endif @@ -1552,6 +1553,8 @@ public class FakeIOException : IOException /// /// The that holds the serialized object data about the exception being thrown. /// The that contains contextual information about the source or destination. + [Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.")] + [EditorBrowsable(EditorBrowsableState.Never)] protected FakeIOException(SerializationInfo info, StreamingContext context) : base(info, context) { diff --git a/src/Lucene.Net/Index/CorruptIndexException.cs b/src/Lucene.Net/Index/CorruptIndexException.cs index ceb2d5b572..3952aae853 100644 --- a/src/Lucene.Net/Index/CorruptIndexException.cs +++ b/src/Lucene.Net/Index/CorruptIndexException.cs @@ -1,6 +1,7 @@ -using System; +using System; using System.IO; #if FEATURE_SERIALIZABLE_EXCEPTIONS +using System.ComponentModel; using System.Runtime.Serialization; #endif @@ -54,10 +55,12 @@ public CorruptIndexException(string message, Exception ex) /// /// The that holds the serialized object data about the exception being thrown. /// The that contains contextual information about the source or destination. + [Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.")] + [EditorBrowsable(EditorBrowsableState.Never)] protected CorruptIndexException(SerializationInfo info, StreamingContext context) : base(info, context) { } #endif } -} \ No newline at end of file +} diff --git a/src/Lucene.Net/Index/IndexFormatTooNewException.cs b/src/Lucene.Net/Index/IndexFormatTooNewException.cs index ef04db4b1c..53c8c08d01 100644 --- a/src/Lucene.Net/Index/IndexFormatTooNewException.cs +++ b/src/Lucene.Net/Index/IndexFormatTooNewException.cs @@ -1,6 +1,8 @@ using Lucene.Net.Diagnostics; using System; + #if FEATURE_SERIALIZABLE_EXCEPTIONS +using System.ComponentModel; using System.Runtime.Serialization; #endif @@ -77,10 +79,12 @@ internal IndexFormatTooNewException(string message) /// /// The that holds the serialized object data about the exception being thrown. /// The that contains contextual information about the source or destination. + [Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.")] + [EditorBrowsable(EditorBrowsableState.Never)] protected IndexFormatTooNewException(SerializationInfo info, StreamingContext context) : base(info, context) { } #endif } -} \ No newline at end of file +} diff --git a/src/Lucene.Net/Index/IndexFormatTooOldException.cs b/src/Lucene.Net/Index/IndexFormatTooOldException.cs index 25cb849e4c..e918788739 100644 --- a/src/Lucene.Net/Index/IndexFormatTooOldException.cs +++ b/src/Lucene.Net/Index/IndexFormatTooOldException.cs @@ -1,6 +1,8 @@ using Lucene.Net.Diagnostics; using System; + #if FEATURE_SERIALIZABLE_EXCEPTIONS +using System.ComponentModel; using System.Runtime.Serialization; #endif @@ -102,10 +104,12 @@ internal IndexFormatTooOldException(string message) /// /// The that holds the serialized object data about the exception being thrown. /// The that contains contextual information about the source or destination. + [Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.")] + [EditorBrowsable(EditorBrowsableState.Never)] protected IndexFormatTooOldException(SerializationInfo info, StreamingContext context) : base(info, context) { } #endif } -} \ No newline at end of file +} diff --git a/src/Lucene.Net/Index/IndexNotFoundException.cs b/src/Lucene.Net/Index/IndexNotFoundException.cs index ec01fc6c48..ce1fcd1c43 100644 --- a/src/Lucene.Net/Index/IndexNotFoundException.cs +++ b/src/Lucene.Net/Index/IndexNotFoundException.cs @@ -1,6 +1,7 @@ -using System; +using System; using System.IO; #if FEATURE_SERIALIZABLE_EXCEPTIONS +using System.ComponentModel; using System.Runtime.Serialization; #endif @@ -49,10 +50,12 @@ public IndexNotFoundException(string message) /// /// The that holds the serialized object data about the exception being thrown. /// The that contains contextual information about the source or destination. + [Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.")] + [EditorBrowsable(EditorBrowsableState.Never)] private IndexNotFoundException(SerializationInfo info, StreamingContext context) : base(info, context) { } #endif } -} \ No newline at end of file +} diff --git a/src/Lucene.Net/Index/MergePolicy.cs b/src/Lucene.Net/Index/MergePolicy.cs index 5423ba3190..efacf2e572 100644 --- a/src/Lucene.Net/Index/MergePolicy.cs +++ b/src/Lucene.Net/Index/MergePolicy.cs @@ -7,6 +7,7 @@ using System.IO; using System.Runtime.CompilerServices; #if FEATURE_SERIALIZABLE_EXCEPTIONS +using System.ComponentModel; using System.Runtime.Serialization; #endif using System.Text; @@ -525,6 +526,8 @@ internal MergeException(string message) /// /// The that holds the serialized object data about the exception being thrown. /// The that contains contextual information about the source or destination. + [Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.")] + [EditorBrowsable(EditorBrowsableState.Never)] protected MergeException(SerializationInfo info, StreamingContext context) : base(info, context) { @@ -573,6 +576,8 @@ public MergeAbortedException(string message) /// /// The that holds the serialized object data about the exception being thrown. /// The that contains contextual information about the source or destination. + [Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.")] + [EditorBrowsable(EditorBrowsableState.Never)] protected MergeAbortedException(SerializationInfo info, StreamingContext context) : base(info, context) { diff --git a/src/Lucene.Net/Index/TwoPhaseCommitTool.cs b/src/Lucene.Net/Index/TwoPhaseCommitTool.cs index 0289c15bae..645a62d409 100644 --- a/src/Lucene.Net/Index/TwoPhaseCommitTool.cs +++ b/src/Lucene.Net/Index/TwoPhaseCommitTool.cs @@ -1,6 +1,7 @@ using System; using System.IO; #if FEATURE_SERIALIZABLE_EXCEPTIONS +using System.ComponentModel; using System.Runtime.Serialization; #endif @@ -68,6 +69,8 @@ internal PrepareCommitFailException(string message) /// /// The that holds the serialized object data about the exception being thrown. /// The that contains contextual information about the source or destination. + [Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.")] + [EditorBrowsable(EditorBrowsableState.Never)] protected PrepareCommitFailException(SerializationInfo info, StreamingContext context) : base(info, context) { @@ -105,6 +108,8 @@ internal CommitFailException(string message) /// /// The that holds the serialized object data about the exception being thrown. /// The that contains contextual information about the source or destination. + [Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.")] + [EditorBrowsable(EditorBrowsableState.Never)] protected CommitFailException(SerializationInfo info, StreamingContext context) : base(info, context) { @@ -198,4 +203,4 @@ public static void Execute(params ITwoPhaseCommit[] objects) } } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net/Search/BooleanQuery.cs b/src/Lucene.Net/Search/BooleanQuery.cs index ad0bd27f34..c1b9c73718 100644 --- a/src/Lucene.Net/Search/BooleanQuery.cs +++ b/src/Lucene.Net/Search/BooleanQuery.cs @@ -4,7 +4,9 @@ using System; using System.Collections; using System.Collections.Generic; + #if FEATURE_SERIALIZABLE_EXCEPTIONS +using System.ComponentModel; using System.Runtime.Serialization; #endif using System.Text; @@ -94,6 +96,8 @@ public TooManyClausesException() /// /// The that holds the serialized object data about the exception being thrown. /// The that contains contextual information about the source or destination. + [Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.")] + [EditorBrowsable(EditorBrowsableState.Never)] protected TooManyClausesException(SerializationInfo info, StreamingContext context) : base(info, context) { @@ -694,4 +698,4 @@ public override int GetHashCode() + MinimumNumberShouldMatch + (disableCoord ? 17 : 0); } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net/Search/CollectionTerminatedException.cs b/src/Lucene.Net/Search/CollectionTerminatedException.cs index 1acd67052f..1e212a179a 100644 --- a/src/Lucene.Net/Search/CollectionTerminatedException.cs +++ b/src/Lucene.Net/Search/CollectionTerminatedException.cs @@ -1,5 +1,7 @@ using System; + #if FEATURE_SERIALIZABLE_EXCEPTIONS +using System.ComponentModel; using System.Runtime.Serialization; #endif @@ -50,10 +52,12 @@ public CollectionTerminatedException() /// /// The that holds the serialized object data about the exception being thrown. /// The that contains contextual information about the source or destination. + [Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.")] + [EditorBrowsable(EditorBrowsableState.Never)] private CollectionTerminatedException(SerializationInfo info, StreamingContext context) : base(info, context) { } #endif } -} \ No newline at end of file +} diff --git a/src/Lucene.Net/Search/TimeLimitingCollector.cs b/src/Lucene.Net/Search/TimeLimitingCollector.cs index 6cc52dadf3..8a3993d20f 100644 --- a/src/Lucene.Net/Search/TimeLimitingCollector.cs +++ b/src/Lucene.Net/Search/TimeLimitingCollector.cs @@ -1,7 +1,9 @@ using J2N.Threading; using Lucene.Net.Support.Threading; using System; + #if FEATURE_SERIALIZABLE_EXCEPTIONS +using System.ComponentModel; using System.Runtime.Serialization; #endif #if FEATURE_CODE_ACCESS_SECURITY @@ -72,6 +74,8 @@ internal TimeExceededException(string message) /// /// The that holds the serialized object data about the exception being thrown. /// The that contains contextual information about the source or destination. + [Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.")] + [EditorBrowsable(EditorBrowsableState.Never)] protected TimeExceededException(SerializationInfo info, StreamingContext context) : base(info, context) { @@ -83,7 +87,11 @@ protected TimeExceededException(SerializationInfo info, StreamingContext context #if FEATURE_CODE_ACCESS_SECURITY [SecurityPermission(SecurityAction.Demand, SerializationFormatter = true)] #endif + [Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.")] + [EditorBrowsable(EditorBrowsableState.Never)] +#pragma warning disable CS0809 // Obsolete member overrides non-obsolete member public override void GetObjectData(SerializationInfo info, StreamingContext context) +#pragma warning restore CS0809 // Obsolete member overrides non-obsolete member { base.GetObjectData(info, context); info.AddValue("timeAllowed", timeAllowed, typeof(long)); @@ -342,4 +350,4 @@ public long Resolution } } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net/Store/AlreadyClosedException.cs b/src/Lucene.Net/Store/AlreadyClosedException.cs index cf30372b11..f9f0036fe5 100644 --- a/src/Lucene.Net/Store/AlreadyClosedException.cs +++ b/src/Lucene.Net/Store/AlreadyClosedException.cs @@ -5,6 +5,7 @@ // which is intended to make porting efforts easier. //using System; //#if FEATURE_SERIALIZABLE_EXCEPTIONS +//using System.ComponentModel; //using System.Runtime.Serialization; //#endif @@ -54,10 +55,12 @@ // /// // /// The that holds the serialized object data about the exception being thrown. // /// The that contains contextual information about the source or destination. +// [Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.")] +// [EditorBrowsable(EditorBrowsableState.Never)] // protected AlreadyClosedException(SerializationInfo info, StreamingContext context) // : base(info, context) // { // } //#endif // } -//} \ No newline at end of file +//} diff --git a/src/Lucene.Net/Store/LockObtainFailedException.cs b/src/Lucene.Net/Store/LockObtainFailedException.cs index 8d02eb7cbb..267b04088d 100644 --- a/src/Lucene.Net/Store/LockObtainFailedException.cs +++ b/src/Lucene.Net/Store/LockObtainFailedException.cs @@ -1,6 +1,7 @@ -using System; +using System; using System.IO; #if FEATURE_SERIALIZABLE_EXCEPTIONS +using System.ComponentModel; using System.Runtime.Serialization; #endif @@ -52,10 +53,12 @@ public LockObtainFailedException(string message, Exception ex) /// /// The that holds the serialized object data about the exception being thrown. /// The that contains contextual information about the source or destination. + [Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.")] + [EditorBrowsable(EditorBrowsableState.Never)] protected LockObtainFailedException(SerializationInfo info, StreamingContext context) : base(info, context) { } #endif } -} \ No newline at end of file +} diff --git a/src/Lucene.Net/Store/LockReleaseFailedException.cs b/src/Lucene.Net/Store/LockReleaseFailedException.cs index 875d171ed6..3ebec3b0f6 100644 --- a/src/Lucene.Net/Store/LockReleaseFailedException.cs +++ b/src/Lucene.Net/Store/LockReleaseFailedException.cs @@ -1,6 +1,7 @@ -using System; +using System; using System.IO; #if FEATURE_SERIALIZABLE_EXCEPTIONS +using System.ComponentModel; using System.Runtime.Serialization; #endif @@ -45,10 +46,12 @@ public LockReleaseFailedException(string message) /// /// The that holds the serialized object data about the exception being thrown. /// The that contains contextual information about the source or destination. + [Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.")] + [EditorBrowsable(EditorBrowsableState.Never)] protected LockReleaseFailedException(SerializationInfo info, StreamingContext context) : base(info, context) { } #endif } -} \ No newline at end of file +} diff --git a/src/Lucene.Net/Support/Diagnostics/AssertionException.cs b/src/Lucene.Net/Support/Diagnostics/AssertionException.cs index 9553d576b9..ad3d46c129 100644 --- a/src/Lucene.Net/Support/Diagnostics/AssertionException.cs +++ b/src/Lucene.Net/Support/Diagnostics/AssertionException.cs @@ -1,5 +1,7 @@ using System; + #if FEATURE_SERIALIZABLE_EXCEPTIONS +using System.ComponentModel; using System.Runtime.Serialization; #endif @@ -61,6 +63,8 @@ public AssertionException(string message, Exception innerException) /// /// The that holds the serialized object data about the exception being thrown. /// The that contains contextual information about the source or destination. + [Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.")] + [EditorBrowsable(EditorBrowsableState.Never)] protected AssertionException(SerializationInfo info, StreamingContext context) : base(info, context) { diff --git a/src/Lucene.Net/Support/ExceptionHandling/Errors/AssertionError.cs b/src/Lucene.Net/Support/ExceptionHandling/Errors/AssertionError.cs index ef2f6b3d96..b053780b53 100644 --- a/src/Lucene.Net/Support/ExceptionHandling/Errors/AssertionError.cs +++ b/src/Lucene.Net/Support/ExceptionHandling/Errors/AssertionError.cs @@ -1,5 +1,6 @@ using Lucene.Net.Diagnostics; using System; +using System.ComponentModel; using System.Runtime.CompilerServices; using System.Runtime.Serialization; @@ -67,6 +68,8 @@ public AssertionError(Exception cause) : base(cause?.ToString(), cause) /// /// The that holds the serialized object data about the exception being thrown. /// The that contains contextual information about the source or destination. + [Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.")] + [EditorBrowsable(EditorBrowsableState.Never)] protected AssertionError(SerializationInfo info, StreamingContext context) : base(info, context) { diff --git a/src/Lucene.Net/Support/ExceptionHandling/Errors/Error.cs b/src/Lucene.Net/Support/ExceptionHandling/Errors/Error.cs index 6ef4082111..9ae03013b0 100644 --- a/src/Lucene.Net/Support/ExceptionHandling/Errors/Error.cs +++ b/src/Lucene.Net/Support/ExceptionHandling/Errors/Error.cs @@ -1,5 +1,6 @@ using Lucene.Net.Diagnostics; using System; +using System.ComponentModel; using System.Runtime.CompilerServices; using System.Runtime.Serialization; @@ -73,6 +74,8 @@ public Error(Exception cause) /// /// The that holds the serialized object data about the exception being thrown. /// The that contains contextual information about the source or destination. + [Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.")] + [EditorBrowsable(EditorBrowsableState.Never)] protected Error(SerializationInfo info, StreamingContext context) : base(info, context) { diff --git a/src/Lucene.Net/Support/ExceptionHandling/Errors/NoClassDefFoundError.cs b/src/Lucene.Net/Support/ExceptionHandling/Errors/NoClassDefFoundError.cs index 196f639a48..f3b8f4ce59 100644 --- a/src/Lucene.Net/Support/ExceptionHandling/Errors/NoClassDefFoundError.cs +++ b/src/Lucene.Net/Support/ExceptionHandling/Errors/NoClassDefFoundError.cs @@ -1,4 +1,5 @@ using System; +using System.ComponentModel; using System.Runtime.CompilerServices; using System.Runtime.Serialization; @@ -68,6 +69,8 @@ public NoClassDefFoundError(Exception cause) : base(cause?.ToString(), cause) /// /// The that holds the serialized object data about the exception being thrown. /// The that contains contextual information about the source or destination. + [Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.")] + [EditorBrowsable(EditorBrowsableState.Never)] protected NoClassDefFoundError(SerializationInfo info, StreamingContext context) : base(info, context) { diff --git a/src/Lucene.Net/Support/ExceptionHandling/Errors/OutOfMemoryError.cs b/src/Lucene.Net/Support/ExceptionHandling/Errors/OutOfMemoryError.cs index d9f22ab2b2..b35b00f695 100644 --- a/src/Lucene.Net/Support/ExceptionHandling/Errors/OutOfMemoryError.cs +++ b/src/Lucene.Net/Support/ExceptionHandling/Errors/OutOfMemoryError.cs @@ -1,4 +1,5 @@ using System; +using System.ComponentModel; using System.Runtime.CompilerServices; using System.Runtime.Serialization; @@ -69,6 +70,8 @@ public OutOfMemoryError(Exception cause) : base(cause?.ToString(), cause) /// /// The that holds the serialized object data about the exception being thrown. /// The that contains contextual information about the source or destination. + [Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.")] + [EditorBrowsable(EditorBrowsableState.Never)] protected OutOfMemoryError(SerializationInfo info, StreamingContext context) : base(info, context) { diff --git a/src/Lucene.Net/Support/ExceptionHandling/Errors/ServiceConfigurationError.cs b/src/Lucene.Net/Support/ExceptionHandling/Errors/ServiceConfigurationError.cs index a1a4fab701..247dee13ec 100644 --- a/src/Lucene.Net/Support/ExceptionHandling/Errors/ServiceConfigurationError.cs +++ b/src/Lucene.Net/Support/ExceptionHandling/Errors/ServiceConfigurationError.cs @@ -1,4 +1,5 @@ using System; +using System.ComponentModel; using System.IO; using System.Runtime.CompilerServices; using System.Runtime.Serialization; @@ -97,6 +98,8 @@ private ServiceConfigurationError(Exception cause, bool privateOverload) /// /// The that holds the serialized object data about the exception being thrown. /// The that contains contextual information about the source or destination. + [Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.")] + [EditorBrowsable(EditorBrowsableState.Never)] protected ServiceConfigurationError(SerializationInfo info, StreamingContext context) : base(info, context) { diff --git a/src/Lucene.Net/Support/ExceptionHandling/Errors/StackOverflowError.cs b/src/Lucene.Net/Support/ExceptionHandling/Errors/StackOverflowError.cs index 171b4329b4..39e920cf34 100644 --- a/src/Lucene.Net/Support/ExceptionHandling/Errors/StackOverflowError.cs +++ b/src/Lucene.Net/Support/ExceptionHandling/Errors/StackOverflowError.cs @@ -1,4 +1,5 @@ using System; +using System.ComponentModel; using System.Runtime.CompilerServices; using System.Runtime.Serialization; @@ -65,6 +66,8 @@ public StackOverflowError(Exception cause) : base(cause?.ToString(), cause) /// /// The that holds the serialized object data about the exception being thrown. /// The that contains contextual information about the source or destination. + [Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.")] + [EditorBrowsable(EditorBrowsableState.Never)] protected StackOverflowError(SerializationInfo info, StreamingContext context) : base(info, context) { diff --git a/src/Lucene.Net/Support/ExceptionHandling/Exceptions/ClassNotFoundException.cs b/src/Lucene.Net/Support/ExceptionHandling/Exceptions/ClassNotFoundException.cs index 59a1a1a740..78d1664dba 100644 --- a/src/Lucene.Net/Support/ExceptionHandling/Exceptions/ClassNotFoundException.cs +++ b/src/Lucene.Net/Support/ExceptionHandling/Exceptions/ClassNotFoundException.cs @@ -1,4 +1,5 @@ using System; +using System.ComponentModel; using System.Runtime.CompilerServices; using System.Runtime.Serialization; @@ -78,6 +79,8 @@ public ClassNotFoundException(Exception cause) /// /// The that holds the serialized object data about the exception being thrown. /// The that contains contextual information about the source or destination. + [Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.")] + [EditorBrowsable(EditorBrowsableState.Never)] protected ClassNotFoundException(SerializationInfo info, StreamingContext context) : base(info, context) { diff --git a/src/Lucene.Net/Support/ExceptionHandling/Exceptions/IOExceptions/AlreadyClosedException.cs b/src/Lucene.Net/Support/ExceptionHandling/Exceptions/IOExceptions/AlreadyClosedException.cs index 38f5e952d8..c713e0a14f 100644 --- a/src/Lucene.Net/Support/ExceptionHandling/Exceptions/IOExceptions/AlreadyClosedException.cs +++ b/src/Lucene.Net/Support/ExceptionHandling/Exceptions/IOExceptions/AlreadyClosedException.cs @@ -1,4 +1,5 @@ using System; +using System.ComponentModel; using System.Runtime.CompilerServices; using System.Runtime.Serialization; @@ -63,6 +64,8 @@ public AlreadyClosedException(Exception cause) /// /// The that holds the serialized object data about the exception being thrown. /// The that contains contextual information about the source or destination. + [Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.")] + [EditorBrowsable(EditorBrowsableState.Never)] protected AlreadyClosedException(SerializationInfo info, StreamingContext context) : base(info, context) { diff --git a/src/Lucene.Net/Support/ExceptionHandling/Exceptions/IOExceptions/EOFException.cs b/src/Lucene.Net/Support/ExceptionHandling/Exceptions/IOExceptions/EOFException.cs index c4de0c5008..9cf27ed6ea 100644 --- a/src/Lucene.Net/Support/ExceptionHandling/Exceptions/IOExceptions/EOFException.cs +++ b/src/Lucene.Net/Support/ExceptionHandling/Exceptions/IOExceptions/EOFException.cs @@ -1,5 +1,6 @@ using Lucene.Net.Diagnostics; using System; +using System.ComponentModel; using System.IO; using System.Runtime.CompilerServices; using System.Runtime.Serialization; @@ -71,6 +72,8 @@ public EOFException(Exception cause) /// /// The that holds the serialized object data about the exception being thrown. /// The that contains contextual information about the source or destination. + [Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.")] + [EditorBrowsable(EditorBrowsableState.Never)] protected EOFException(SerializationInfo info, StreamingContext context) : base(info, context) { diff --git a/src/Lucene.Net/Support/ExceptionHandling/Exceptions/NoSuchMethodException.cs b/src/Lucene.Net/Support/ExceptionHandling/Exceptions/NoSuchMethodException.cs index 7d3c284759..dc0fe4fde9 100644 --- a/src/Lucene.Net/Support/ExceptionHandling/Exceptions/NoSuchMethodException.cs +++ b/src/Lucene.Net/Support/ExceptionHandling/Exceptions/NoSuchMethodException.cs @@ -1,4 +1,5 @@ using System; +using System.ComponentModel; using System.Runtime.CompilerServices; using System.Runtime.Serialization; @@ -65,6 +66,8 @@ public NoSuchMethodException(Exception cause) /// /// The that holds the serialized object data about the exception being thrown. /// The that contains contextual information about the source or destination. + [Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.")] + [EditorBrowsable(EditorBrowsableState.Never)] protected NoSuchMethodException(SerializationInfo info, StreamingContext context) : base(info, context) { diff --git a/src/Lucene.Net/Support/ExceptionHandling/Exceptions/RuntimeExceptions/ArrayIndexOutOfBoundsException.cs b/src/Lucene.Net/Support/ExceptionHandling/Exceptions/RuntimeExceptions/ArrayIndexOutOfBoundsException.cs index d9ebe4eeb8..da82d12cf9 100644 --- a/src/Lucene.Net/Support/ExceptionHandling/Exceptions/RuntimeExceptions/ArrayIndexOutOfBoundsException.cs +++ b/src/Lucene.Net/Support/ExceptionHandling/Exceptions/RuntimeExceptions/ArrayIndexOutOfBoundsException.cs @@ -1,4 +1,5 @@ using System; +using System.ComponentModel; using System.Runtime.CompilerServices; using System.Runtime.Serialization; @@ -70,6 +71,8 @@ public ArrayIndexOutOfBoundsException(Exception cause) /// /// The that holds the serialized object data about the exception being thrown. /// The that contains contextual information about the source or destination. + [Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.")] + [EditorBrowsable(EditorBrowsableState.Never)] protected ArrayIndexOutOfBoundsException(SerializationInfo info, StreamingContext context) : base(info, context) { diff --git a/src/Lucene.Net/Support/ExceptionHandling/Exceptions/RuntimeExceptions/IllegalArgumentException.cs b/src/Lucene.Net/Support/ExceptionHandling/Exceptions/RuntimeExceptions/IllegalArgumentException.cs index bf194e03da..5ba73342d2 100644 --- a/src/Lucene.Net/Support/ExceptionHandling/Exceptions/RuntimeExceptions/IllegalArgumentException.cs +++ b/src/Lucene.Net/Support/ExceptionHandling/Exceptions/RuntimeExceptions/IllegalArgumentException.cs @@ -1,4 +1,5 @@ using System; +using System.ComponentModel; using System.Runtime.CompilerServices; using System.Runtime.Serialization; @@ -73,6 +74,8 @@ public IllegalArgumentException(Exception cause) /// /// The that holds the serialized object data about the exception being thrown. /// The that contains contextual information about the source or destination. + [Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.")] + [EditorBrowsable(EditorBrowsableState.Never)] protected IllegalArgumentException(SerializationInfo info, StreamingContext context) : base(info, context) { diff --git a/src/Lucene.Net/Support/ExceptionHandling/Exceptions/RuntimeExceptions/IllegalStateException.cs b/src/Lucene.Net/Support/ExceptionHandling/Exceptions/RuntimeExceptions/IllegalStateException.cs index 3b1276d5ab..e47dc7b436 100644 --- a/src/Lucene.Net/Support/ExceptionHandling/Exceptions/RuntimeExceptions/IllegalStateException.cs +++ b/src/Lucene.Net/Support/ExceptionHandling/Exceptions/RuntimeExceptions/IllegalStateException.cs @@ -1,4 +1,5 @@ using System; +using System.ComponentModel; using System.Runtime.CompilerServices; using System.Runtime.Serialization; @@ -67,6 +68,8 @@ public IllegalStateException(Exception cause) /// /// The that holds the serialized object data about the exception being thrown. /// The that contains contextual information about the source or destination. + [Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.")] + [EditorBrowsable(EditorBrowsableState.Never)] protected IllegalStateException(SerializationInfo info, StreamingContext context) : base(info, context) { diff --git a/src/Lucene.Net/Support/ExceptionHandling/Exceptions/RuntimeExceptions/IndexOutOfBoundsException.cs b/src/Lucene.Net/Support/ExceptionHandling/Exceptions/RuntimeExceptions/IndexOutOfBoundsException.cs index 7e52f0634f..57dea76dec 100644 --- a/src/Lucene.Net/Support/ExceptionHandling/Exceptions/RuntimeExceptions/IndexOutOfBoundsException.cs +++ b/src/Lucene.Net/Support/ExceptionHandling/Exceptions/RuntimeExceptions/IndexOutOfBoundsException.cs @@ -1,4 +1,5 @@ using System; +using System.ComponentModel; using System.Runtime.CompilerServices; using System.Runtime.Serialization; @@ -69,6 +70,8 @@ public IndexOutOfBoundsException(Exception cause) /// /// The that holds the serialized object data about the exception being thrown. /// The that contains contextual information about the source or destination. + [Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.")] + [EditorBrowsable(EditorBrowsableState.Never)] protected IndexOutOfBoundsException(SerializationInfo info, StreamingContext context) : base(info, context) { diff --git a/src/Lucene.Net/Support/ExceptionHandling/Exceptions/RuntimeExceptions/NullPointerException.cs b/src/Lucene.Net/Support/ExceptionHandling/Exceptions/RuntimeExceptions/NullPointerException.cs index 955d0b8197..123e561a75 100644 --- a/src/Lucene.Net/Support/ExceptionHandling/Exceptions/RuntimeExceptions/NullPointerException.cs +++ b/src/Lucene.Net/Support/ExceptionHandling/Exceptions/RuntimeExceptions/NullPointerException.cs @@ -1,4 +1,5 @@ using System; +using System.ComponentModel; using System.Runtime.CompilerServices; using System.Runtime.Serialization; @@ -108,6 +109,8 @@ public NullPointerException(Exception cause) /// /// The that holds the serialized object data about the exception being thrown. /// The that contains contextual information about the source or destination. + [Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.")] + [EditorBrowsable(EditorBrowsableState.Never)] protected NullPointerException(SerializationInfo info, StreamingContext context) : base(info, context) { diff --git a/src/Lucene.Net/Support/ExceptionHandling/Exceptions/RuntimeExceptions/NumberFormatException.cs b/src/Lucene.Net/Support/ExceptionHandling/Exceptions/RuntimeExceptions/NumberFormatException.cs index aafd9cda8a..cbc204c22c 100644 --- a/src/Lucene.Net/Support/ExceptionHandling/Exceptions/RuntimeExceptions/NumberFormatException.cs +++ b/src/Lucene.Net/Support/ExceptionHandling/Exceptions/RuntimeExceptions/NumberFormatException.cs @@ -1,4 +1,5 @@ using System; +using System.ComponentModel; using System.Runtime.CompilerServices; using System.Runtime.Serialization; @@ -68,6 +69,8 @@ public NumberFormatException(Exception cause) /// /// The that holds the serialized object data about the exception being thrown. /// The that contains contextual information about the source or destination. + [Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.")] + [EditorBrowsable(EditorBrowsableState.Never)] protected NumberFormatException(SerializationInfo info, StreamingContext context) : base(info, context) { diff --git a/src/Lucene.Net/Support/ExceptionHandling/Exceptions/RuntimeExceptions/RuntimeException.cs b/src/Lucene.Net/Support/ExceptionHandling/Exceptions/RuntimeExceptions/RuntimeException.cs index e37099b836..dd453519b9 100644 --- a/src/Lucene.Net/Support/ExceptionHandling/Exceptions/RuntimeExceptions/RuntimeException.cs +++ b/src/Lucene.Net/Support/ExceptionHandling/Exceptions/RuntimeExceptions/RuntimeException.cs @@ -1,5 +1,6 @@ using Lucene.Net.Util; using System; +using System.ComponentModel; using System.Runtime.Serialization; namespace Lucene @@ -74,6 +75,8 @@ public RuntimeException(Exception cause) /// /// The that holds the serialized object data about the exception being thrown. /// The that contains contextual information about the source or destination. + [Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.")] + [EditorBrowsable(EditorBrowsableState.Never)] protected RuntimeException(SerializationInfo info, StreamingContext context) : base(info, context) { diff --git a/src/Lucene.Net/Support/ExceptionHandling/Exceptions/RuntimeExceptions/StringIndexOutOfBoundsException.cs b/src/Lucene.Net/Support/ExceptionHandling/Exceptions/RuntimeExceptions/StringIndexOutOfBoundsException.cs index 6b322048ba..7963c25af6 100644 --- a/src/Lucene.Net/Support/ExceptionHandling/Exceptions/RuntimeExceptions/StringIndexOutOfBoundsException.cs +++ b/src/Lucene.Net/Support/ExceptionHandling/Exceptions/RuntimeExceptions/StringIndexOutOfBoundsException.cs @@ -1,4 +1,5 @@ using System; +using System.ComponentModel; using System.Runtime.CompilerServices; using System.Runtime.Serialization; @@ -70,6 +71,8 @@ public StringIndexOutOfBoundsException(Exception cause) /// /// The that holds the serialized object data about the exception being thrown. /// The that contains contextual information about the source or destination. + [Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.")] + [EditorBrowsable(EditorBrowsableState.Never)] protected StringIndexOutOfBoundsException(SerializationInfo info, StreamingContext context) : base(info, context) { diff --git a/src/Lucene.Net/Support/ExceptionHandling/Exceptions/RuntimeExceptions/UnsupportedOperationException.cs b/src/Lucene.Net/Support/ExceptionHandling/Exceptions/RuntimeExceptions/UnsupportedOperationException.cs index 4d2f872635..d3e8234a92 100644 --- a/src/Lucene.Net/Support/ExceptionHandling/Exceptions/RuntimeExceptions/UnsupportedOperationException.cs +++ b/src/Lucene.Net/Support/ExceptionHandling/Exceptions/RuntimeExceptions/UnsupportedOperationException.cs @@ -1,4 +1,5 @@ using System; +using System.ComponentModel; using System.Runtime.CompilerServices; using System.Runtime.Serialization; @@ -67,6 +68,8 @@ public UnsupportedOperationException(Exception cause) /// /// The that holds the serialized object data about the exception being thrown. /// The that contains contextual information about the source or destination. + [Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.")] + [EditorBrowsable(EditorBrowsableState.Never)] protected UnsupportedOperationException(SerializationInfo info, StreamingContext context) : base(info, context) { diff --git a/src/Lucene.Net/Support/ExceptionHandling/Exceptions/ServletException.cs b/src/Lucene.Net/Support/ExceptionHandling/Exceptions/ServletException.cs index 317b1ed197..f6a3942b24 100644 --- a/src/Lucene.Net/Support/ExceptionHandling/Exceptions/ServletException.cs +++ b/src/Lucene.Net/Support/ExceptionHandling/Exceptions/ServletException.cs @@ -1,4 +1,5 @@ using System; +using System.ComponentModel; using System.Net.Http; using System.Runtime.CompilerServices; using System.Runtime.Serialization; @@ -64,6 +65,8 @@ public ServletException(Exception cause) /// /// The that holds the serialized object data about the exception being thrown. /// The that contains contextual information about the source or destination. + [Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.")] + [EditorBrowsable(EditorBrowsableState.Never)] protected ServletException(SerializationInfo info, StreamingContext context) : base(info, context) { diff --git a/src/Lucene.Net/Support/Util/LuceneSystemException.cs b/src/Lucene.Net/Support/Util/LuceneSystemException.cs index ae6c18c513..74939c84c0 100644 --- a/src/Lucene.Net/Support/Util/LuceneSystemException.cs +++ b/src/Lucene.Net/Support/Util/LuceneSystemException.cs @@ -1,4 +1,5 @@ using System; +using System.ComponentModel; using System.Runtime.Serialization; namespace Lucene.Net.Util @@ -91,6 +92,8 @@ public LuceneSystemException(Exception cause) /// /// The that holds the serialized object data about the exception being thrown. /// The that contains contextual information about the source or destination. + [Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.")] + [EditorBrowsable(EditorBrowsableState.Never)] protected LuceneSystemException(SerializationInfo info, StreamingContext context) : base(info, context) { diff --git a/src/Lucene.Net/Util/BytesRefHash.cs b/src/Lucene.Net/Util/BytesRefHash.cs index d8c2d07e47..2f629f2449 100644 --- a/src/Lucene.Net/Util/BytesRefHash.cs +++ b/src/Lucene.Net/Util/BytesRefHash.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using System.Runtime.CompilerServices; #if FEATURE_SERIALIZABLE_EXCEPTIONS +using System.ComponentModel; using System.Runtime.Serialization; #endif @@ -588,6 +589,8 @@ internal MaxBytesLengthExceededException(string message) /// /// The that holds the serialized object data about the exception being thrown. /// The that contains contextual information about the source or destination. + [Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.")] + [EditorBrowsable(EditorBrowsableState.Never)] protected MaxBytesLengthExceededException(SerializationInfo info, StreamingContext context) : base(info, context) { @@ -679,4 +682,4 @@ public override Counter BytesUsed() } } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net/Util/SetOnce.cs b/src/Lucene.Net/Util/SetOnce.cs index 1372c6d3f7..fbf38c66ef 100644 --- a/src/Lucene.Net/Util/SetOnce.cs +++ b/src/Lucene.Net/Util/SetOnce.cs @@ -2,6 +2,7 @@ using System; using System.Runtime.CompilerServices; #if FEATURE_SERIALIZABLE_EXCEPTIONS +using System.ComponentModel; using System.Runtime.Serialization; #endif @@ -115,10 +116,12 @@ public AlreadySetException() /// /// The that holds the serialized object data about the exception being thrown. /// The that contains contextual information about the source or destination. + [Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.")] + [EditorBrowsable(EditorBrowsableState.Never)] private AlreadySetException(SerializationInfo info, StreamingContext context) : base(info, context) { } #endif } -} \ No newline at end of file +} diff --git a/src/Lucene.Net/Util/ThreadInterruptedException.cs b/src/Lucene.Net/Util/ThreadInterruptedException.cs index 85dbc8965f..f55ae106cc 100644 --- a/src/Lucene.Net/Util/ThreadInterruptedException.cs +++ b/src/Lucene.Net/Util/ThreadInterruptedException.cs @@ -1,5 +1,7 @@ using System; + #if FEATURE_SERIALIZABLE_EXCEPTIONS +using System.ComponentModel; using System.Runtime.Serialization; #endif @@ -55,6 +57,8 @@ public ThreadInterruptedException(string message, Exception innerException) : ba /// /// The that holds the serialized object data about the exception being thrown. /// The that contains contextual information about the source or destination. + [Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.")] + [EditorBrowsable(EditorBrowsableState.Never)] protected ThreadInterruptedException(SerializationInfo info, StreamingContext context) : base(info, context) {