diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index ef9ecb40c2c..a988ff3648e 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -3,7 +3,7 @@ "isRoot": true, "tools": { "csharpasyncgenerator.tool": { - "version": "0.21.1", + "version": "0.22.0", "commands": [ "async-generator" ] diff --git a/.github/workflows/GenerateAsyncCode.yml b/.github/workflows/GenerateAsyncCode.yml index e879a670073..80a392b858c 100644 --- a/.github/workflows/GenerateAsyncCode.yml +++ b/.github/workflows/GenerateAsyncCode.yml @@ -21,7 +21,7 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v4 with: - dotnet-version: 6.0.x + dotnet-version: 8.0.x - name: Generate Async code run: | diff --git a/.github/workflows/NetCoreTests.yml b/.github/workflows/NetCoreTests.yml index 28ab82cc595..81fb907d31e 100644 --- a/.github/workflows/NetCoreTests.yml +++ b/.github/workflows/NetCoreTests.yml @@ -51,7 +51,7 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v4 with: - dotnet-version: 6.0.x + dotnet-version: 8.0.x - name: Build and Test run: | diff --git a/ShowBuildMenu.sh b/ShowBuildMenu.sh index cb133384784..67d44f121dd 100755 --- a/ShowBuildMenu.sh +++ b/ShowBuildMenu.sh @@ -172,8 +172,8 @@ testSetupMenu() { } testRun(){ - dotnet test ./src/NHibernate.Test/NHibernate.Test.csproj -f net6.0 - dotnet test ./src/NHibernate.Test.VisualBasic/NHibernate.Test.VisualBasic.vbproj -f net6.0 + dotnet test ./src/NHibernate.Test/NHibernate.Test.csproj -f net8.0 + dotnet test ./src/NHibernate.Test.VisualBasic/NHibernate.Test.VisualBasic.vbproj -f net8.0 mainMenu } diff --git a/Tools/BuildTool/BuildTool.csproj b/Tools/BuildTool/BuildTool.csproj index cdc734cce53..b3587f9d5a3 100644 --- a/Tools/BuildTool/BuildTool.csproj +++ b/Tools/BuildTool/BuildTool.csproj @@ -1,6 +1,6 @@  Exe - net6.0 + net8.0 \ No newline at end of file diff --git a/build-common/NHibernate.props b/build-common/NHibernate.props index bbea7b75c22..c1479e0d72f 100644 --- a/build-common/NHibernate.props +++ b/build-common/NHibernate.props @@ -6,7 +6,7 @@ 0 dev - 9.0 + 12.0 $(NhVersion).$(VersionPatch) $(VersionSuffix).$(BuildNumber) @@ -14,14 +14,16 @@ $(VersionPrefix).$(BuildNumber) $(VersionPrefix).0 - net48;net6.0 - net461;net48;netcoreapp2.0;netstandard2.0;netstandard2.1;net6.0 + net48;net8.0 + net461;net48;netcoreapp2.0;netstandard2.0;netstandard2.1;net6.0;net8.0 false true NETFX;$(DefineConstants) NETFX,$(DefineConstants) + $(NoWarn);NU1903 $(NoWarn);SYSLIB0011 + $(NoWarn);SYSLIB0011;SYSLIB0050;SYSLIB0051 NHibernate NHibernate.info diff --git a/global.json b/global.json index 6ecdd6167f9..391ba3c2a30 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "6.0.101", + "version": "8.0.100", "rollForward": "latestFeature" } } diff --git a/psake.ps1 b/psake.ps1 index 877321e24e3..0eb342b2875 100644 --- a/psake.ps1 +++ b/psake.ps1 @@ -132,7 +132,7 @@ Task Test -depends Build { 'NHibernate.Test', 'NHibernate.Test.VisualBasic' ) | ForEach-Object { - $assembly = [IO.Path]::Combine("src", $_, "bin", "Release", "net6.0", "$_.dll") + $assembly = [IO.Path]::Combine("src", $_, "bin", "Release", "net8.0", "$_.dll") Exec { dotnet $assembly --labels=before --nocolor "--result=$_-TestResult.xml" } diff --git a/src/AsyncGenerator.yml b/src/AsyncGenerator.yml index 1f763ac1df9..9c5f0a43404 100644 --- a/src/AsyncGenerator.yml +++ b/src/AsyncGenerator.yml @@ -187,7 +187,7 @@ scanForMissingAsyncMembers: - all: true - filePath: NHibernate.Test/NHibernate.Test.csproj - targetFramework: net6.0 + targetFramework: net8.0 concurrentRun: true applyChanges: true suppressDiagnosticFailures: diff --git a/src/NHibernate.Test.VisualBasic/NHibernate.Test.VisualBasic.vbproj b/src/NHibernate.Test.VisualBasic/NHibernate.Test.VisualBasic.vbproj index af019d9d1e5..e720221f895 100644 --- a/src/NHibernate.Test.VisualBasic/NHibernate.Test.VisualBasic.vbproj +++ b/src/NHibernate.Test.VisualBasic/NHibernate.Test.VisualBasic.vbproj @@ -8,14 +8,14 @@ On On - + Exe false - + @@ -30,7 +30,7 @@ - + diff --git a/src/NHibernate.Test/Async/CacheTest/SerializationFixture.cs b/src/NHibernate.Test/Async/CacheTest/SerializationFixture.cs index f2683f7f26c..27a470f9d9b 100644 --- a/src/NHibernate.Test/Async/CacheTest/SerializationFixture.cs +++ b/src/NHibernate.Test/Async/CacheTest/SerializationFixture.cs @@ -30,6 +30,7 @@ namespace NHibernate.Test.CacheTest { using System.Threading.Tasks; + using System.Threading; [TestFixture] public class SerializationFixtureAsync { @@ -312,11 +313,11 @@ private void CheckObjectTypeCacheEntry(AnyType.ObjectTypeCacheEntry original, An Assert.That(copy.EntityName, Is.EqualTo(original.EntityName)); } - private static async Task TestDataContractSerializerAsync(T obj) + private static async Task TestDataContractSerializerAsync(T obj, CancellationToken cancellationToken = default(CancellationToken)) { - var xml = await (DataContractSerializerToXmlAsync(obj)); + var xml = await (DataContractSerializerToXmlAsync(obj, cancellationToken)); obj = DataContractSerializerFromXml(xml); - Assert.That(xml, Is.EqualTo(await (DataContractSerializerToXmlAsync(obj)))); + Assert.That(xml, Is.EqualTo(await (DataContractSerializerToXmlAsync(obj, cancellationToken)))); return obj; } @@ -328,7 +329,7 @@ private static T TestBinaryFormatter(T obj) return obj; } - private static async Task DataContractSerializerToXmlAsync(T obj) + private static async Task DataContractSerializerToXmlAsync(T obj, CancellationToken cancellationToken = default(CancellationToken)) { using (var memoryStream = new MemoryStream()) using (var reader = new StreamReader(memoryStream)) @@ -336,7 +337,7 @@ private static async Task DataContractSerializerToXmlAsync(T obj) var serializer = new DataContractSerializer(typeof(T), KnownTypes); serializer.WriteObject(memoryStream, obj); memoryStream.Position = 0; - return await (reader.ReadToEndAsync()); + return await (reader.ReadToEndAsync(cancellationToken)); } } diff --git a/src/NHibernate.Test/CacheTest/TextReaderExtensions.cs b/src/NHibernate.Test/CacheTest/TextReaderExtensions.cs new file mode 100644 index 00000000000..8b5b55f7cb9 --- /dev/null +++ b/src/NHibernate.Test/CacheTest/TextReaderExtensions.cs @@ -0,0 +1,15 @@ +#if !NET8_0_OR_GREATER +using System.IO; +using System.Threading; +using System.Threading.Tasks; + +namespace NHibernate.Test.CacheTest; + +internal static class TextReaderExtensions +{ + public static Task ReadToEndAsync(this TextReader reader, CancellationToken cancellationToken) => + cancellationToken.IsCancellationRequested + ? Task.FromCanceled(cancellationToken) + : reader.ReadToEndAsync(); +} +#endif diff --git a/src/NHibernate.Test/NHibernate.Test.csproj b/src/NHibernate.Test/NHibernate.Test.csproj index 2ae6cf60202..ee64e604146 100644 --- a/src/NHibernate.Test/NHibernate.Test.csproj +++ b/src/NHibernate.Test/NHibernate.Test.csproj @@ -4,10 +4,11 @@ The Unit Tests for NHibernate. $(NhAppTargetFrameworks) true - $(NoWarn);3001;3002;3003;3005;SYSLIB0003;SYSLIB0012 + $(NoWarn);3001;3002;3003;3005;8981;SYSLIB0003;SYSLIB0012 true + true - + Exe false @@ -38,7 +39,7 @@ PreserveNewest - + @@ -63,7 +64,7 @@ - + @@ -86,10 +87,10 @@ - - + + - + diff --git a/src/NHibernate.TestDatabaseSetup/NHibernate.TestDatabaseSetup.csproj b/src/NHibernate.TestDatabaseSetup/NHibernate.TestDatabaseSetup.csproj index 60d56bb7401..715af02ffb3 100644 --- a/src/NHibernate.TestDatabaseSetup/NHibernate.TestDatabaseSetup.csproj +++ b/src/NHibernate.TestDatabaseSetup/NHibernate.TestDatabaseSetup.csproj @@ -7,7 +7,7 @@ true $(NoWarn);3001;3002;3003;3005 - + Exe false @@ -18,7 +18,7 @@ - + diff --git a/src/NHibernate.sln b/src/NHibernate.sln index 2c7f1c7eb97..4eec9b87633 100644 --- a/src/NHibernate.sln +++ b/src/NHibernate.sln @@ -12,6 +12,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution ..\build-common\common.xml = ..\build-common\common.xml ..\appveyor.yml = ..\appveyor.yml ..\ReleaseProcedure.txt = ..\ReleaseProcedure.txt + ..\global.json = ..\global.json EndProjectSection EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NHibernate", "NHibernate\NHibernate.csproj", "{5909BFE7-93CF-4E5F-BE22-6293368AF01D}" diff --git a/src/NHibernate/ADOException.cs b/src/NHibernate/ADOException.cs index f3c5108b5fd..c0aa5f01916 100644 --- a/src/NHibernate/ADOException.cs +++ b/src/NHibernate/ADOException.cs @@ -21,6 +21,7 @@ public class ADOException : HibernateException public ADOException() { } + /// /// Initializes a new instance of the class. /// @@ -50,17 +51,23 @@ public ADOException(string message, Exception innerException, string sql) /// /// The that contains contextual information about the source or destination. /// + // Since v5.6 + [Obsolete("This API supports obsolete formatter-based serialization and will be removed in a future version")] protected ADOException(SerializationInfo info, StreamingContext context) : base(info, context) { this.sql = (string) info.GetValue("sql", typeof(string)); } +#pragma warning disable CS0809 + // Since v5.6 + [Obsolete("This API supports obsolete formatter-based serialization and will be removed in a future version")] [SecurityCritical] public override void GetObjectData(SerializationInfo info, StreamingContext context) { base.GetObjectData(info, context); info.AddValue("sql", sql); } +#pragma warning restore CS0809 public string SqlString { diff --git a/src/NHibernate/AdoNet/TooManyRowsAffectedException.cs b/src/NHibernate/AdoNet/TooManyRowsAffectedException.cs index bcf54ff1e63..e113040c659 100644 --- a/src/NHibernate/AdoNet/TooManyRowsAffectedException.cs +++ b/src/NHibernate/AdoNet/TooManyRowsAffectedException.cs @@ -18,13 +18,17 @@ public TooManyRowsAffectedException(String message, int expectedRowCount, int ac this.actualRowCount = actualRowCount; } - protected TooManyRowsAffectedException(SerializationInfo info, StreamingContext context) - : base(info, context) + // Since v5.6 + [Obsolete("This API supports obsolete formatter-based serialization and will be removed in a future version")] + protected TooManyRowsAffectedException(SerializationInfo info, StreamingContext context) : base(info, context) { this.expectedRowCount = info.GetInt32("expectedRowCount"); this.actualRowCount = info.GetInt32("actualRowCount"); } +#pragma warning disable CS0809 + // Since v5.6 + [Obsolete("This API supports obsolete formatter-based serialization and will be removed in a future version")] [SecurityCritical] public override void GetObjectData(SerializationInfo info, StreamingContext context) { @@ -32,6 +36,7 @@ public override void GetObjectData(SerializationInfo info, StreamingContext cont info.AddValue("expectedRowCount", expectedRowCount); info.AddValue("actualRowCount", actualRowCount); } +#pragma warning restore CS0809 public int ExpectedRowCount { diff --git a/src/NHibernate/AssertionFailure.cs b/src/NHibernate/AssertionFailure.cs index 52cbbdae11d..4c9bc955b51 100644 --- a/src/NHibernate/AssertionFailure.cs +++ b/src/NHibernate/AssertionFailure.cs @@ -52,6 +52,8 @@ public AssertionFailure(string message, Exception innerException) : base(message /// /// The that contains contextual information about the source or destination. /// + // Since v5.6 + [Obsolete("This API supports obsolete formatter-based serialization and will be removed in a future version")] protected AssertionFailure(SerializationInfo info, StreamingContext context) : base(info, context) { } diff --git a/src/NHibernate/Bytecode/HibernateByteCodeException.cs b/src/NHibernate/Bytecode/HibernateByteCodeException.cs index 803765f88a7..17126c8286e 100644 --- a/src/NHibernate/Bytecode/HibernateByteCodeException.cs +++ b/src/NHibernate/Bytecode/HibernateByteCodeException.cs @@ -10,6 +10,8 @@ public HibernateByteCodeException() {} public HibernateByteCodeException(string message) : base(message) {} public HibernateByteCodeException(string message, Exception inner) : base(message, inner) {} + // Since v5.6 + [Obsolete("This API supports obsolete formatter-based serialization and will be removed in a future version")] protected HibernateByteCodeException(SerializationInfo info, StreamingContext context) : base(info, context) {} } -} \ No newline at end of file +} diff --git a/src/NHibernate/Bytecode/HibernateObjectsFactoryException.cs b/src/NHibernate/Bytecode/HibernateObjectsFactoryException.cs index f4551474bd0..95d4003c12f 100644 --- a/src/NHibernate/Bytecode/HibernateObjectsFactoryException.cs +++ b/src/NHibernate/Bytecode/HibernateObjectsFactoryException.cs @@ -13,6 +13,8 @@ public HibernateObjectsFactoryException() {} public HibernateObjectsFactoryException(string message) : base(message) {} public HibernateObjectsFactoryException(string message, Exception inner) : base(message, inner) {} + // Since v5.6 + [Obsolete("This API supports obsolete formatter-based serialization and will be removed in a future version")] protected HibernateObjectsFactoryException(SerializationInfo info, StreamingContext context) : base(info, context) {} } } diff --git a/src/NHibernate/Bytecode/NotInstrumentedException.cs b/src/NHibernate/Bytecode/NotInstrumentedException.cs index 71a392b9b0a..c03a4a3044a 100644 --- a/src/NHibernate/Bytecode/NotInstrumentedException.cs +++ b/src/NHibernate/Bytecode/NotInstrumentedException.cs @@ -25,7 +25,8 @@ public NotInstrumentedException(string message) : base(message) } /// - protected NotInstrumentedException(SerializationInfo info, StreamingContext context) - : base(info, context) {} + // Since v5.6 + [Obsolete("This API supports obsolete formatter-based serialization and will be removed in a future version")] + protected NotInstrumentedException(SerializationInfo info, StreamingContext context) : base(info, context) {} } } diff --git a/src/NHibernate/Bytecode/UnableToLoadProxyFactoryFactoryException.cs b/src/NHibernate/Bytecode/UnableToLoadProxyFactoryFactoryException.cs index d37d031e370..10f81028196 100644 --- a/src/NHibernate/Bytecode/UnableToLoadProxyFactoryFactoryException.cs +++ b/src/NHibernate/Bytecode/UnableToLoadProxyFactoryFactoryException.cs @@ -13,8 +13,9 @@ public UnableToLoadProxyFactoryFactoryException(string typeName, Exception inner TypeName = typeName; } - protected UnableToLoadProxyFactoryFactoryException(SerializationInfo info, StreamingContext context) - : base(info, context) + // Since v5.6 + [Obsolete("This API supports obsolete formatter-based serialization and will be removed in a future version")] + protected UnableToLoadProxyFactoryFactoryException(SerializationInfo info, StreamingContext context) : base(info, context) { foreach (var entry in info) { @@ -25,12 +26,16 @@ protected UnableToLoadProxyFactoryFactoryException(SerializationInfo info, Strea } } +#pragma warning disable CS0809 + // Since v5.6 + [Obsolete("This API supports obsolete formatter-based serialization and will be removed in a future version")] [SecurityCritical] public override void GetObjectData(SerializationInfo info, StreamingContext context) { base.GetObjectData(info, context); info.AddValue("TypeName", TypeName); } +#pragma warning restore CS0809 public string TypeName { get; } public override string Message diff --git a/src/NHibernate/Cache/CacheException.cs b/src/NHibernate/Cache/CacheException.cs index bb36a8bf039..20f92b96f77 100644 --- a/src/NHibernate/Cache/CacheException.cs +++ b/src/NHibernate/Cache/CacheException.cs @@ -60,8 +60,10 @@ public CacheException(string message, Exception innerException) : base(message, /// /// The that contains contextual information about the source or destination. /// + // Since v5.6 + [Obsolete("This API supports obsolete formatter-based serialization and will be removed in a future version")] protected CacheException(SerializationInfo info, StreamingContext context) : base(info, context) { } } -} \ No newline at end of file +} diff --git a/src/NHibernate/CallbackException.cs b/src/NHibernate/CallbackException.cs index a0b3441eacc..26f288f2237 100644 --- a/src/NHibernate/CallbackException.cs +++ b/src/NHibernate/CallbackException.cs @@ -51,6 +51,8 @@ public CallbackException(string message, Exception innerException) : base(messag /// /// The that contains contextual information about the source or destination. /// + // Since v5.6 + [Obsolete("This API supports obsolete formatter-based serialization and will be removed in a future version")] protected CallbackException(SerializationInfo info, StreamingContext context) : base(info, context) { } diff --git a/src/NHibernate/Cfg/HibernateConfigException.cs b/src/NHibernate/Cfg/HibernateConfigException.cs index 4b04670b489..665b3c601ca 100644 --- a/src/NHibernate/Cfg/HibernateConfigException.cs +++ b/src/NHibernate/Cfg/HibernateConfigException.cs @@ -68,8 +68,9 @@ public HibernateConfigException(string message, Exception innerException) /// /// The that contains contextual information about the source or destination. /// - protected HibernateConfigException(SerializationInfo info, StreamingContext context) - : base(info, context) + // Since v5.6 + [Obsolete("This API supports obsolete formatter-based serialization and will be removed in a future version")] + protected HibernateConfigException(SerializationInfo info, StreamingContext context) : base(info, context) { } } diff --git a/src/NHibernate/Classic/ValidationFailure.cs b/src/NHibernate/Classic/ValidationFailure.cs index 446dd5f7f4c..704f71b2295 100644 --- a/src/NHibernate/Classic/ValidationFailure.cs +++ b/src/NHibernate/Classic/ValidationFailure.cs @@ -61,6 +61,8 @@ public ValidationFailure(string message, Exception innerException) : base(messag /// /// The that contains contextual information about the source or destination. /// + // Since v5.6 + [Obsolete("This API supports obsolete formatter-based serialization and will be removed in a future version")] protected ValidationFailure(SerializationInfo info, StreamingContext context) : base(info, context) { } diff --git a/src/NHibernate/Collection/Generic/SetHelpers/SetSnapShot.cs b/src/NHibernate/Collection/Generic/SetHelpers/SetSnapShot.cs index 475bebf6c2e..0c0169f8b06 100644 --- a/src/NHibernate/Collection/Generic/SetHelpers/SetSnapShot.cs +++ b/src/NHibernate/Collection/Generic/SetHelpers/SetSnapShot.cs @@ -151,6 +151,8 @@ public SetSnapShot(IEnumerable collection) : base(collection) { } + // Since v5.6 + [Obsolete("This API supports obsolete formatter-based serialization and will be removed in a future version")] protected SetSnapShot(SerializationInfo info, StreamingContext context) : base(info, context) { } diff --git a/src/NHibernate/DuplicateMappingException.cs b/src/NHibernate/DuplicateMappingException.cs index 3b9d43ce626..4fe33607324 100644 --- a/src/NHibernate/DuplicateMappingException.cs +++ b/src/NHibernate/DuplicateMappingException.cs @@ -41,8 +41,9 @@ public DuplicateMappingException(string type, string name) /// /// The that contains contextual information about the source or destination. /// - public DuplicateMappingException(SerializationInfo info, StreamingContext context) - : base(info, context) + // Since v5.6 + [Obsolete("This API supports obsolete formatter-based serialization and will be removed in a future version")] + public DuplicateMappingException(SerializationInfo info, StreamingContext context) : base(info, context) { foreach (var entry in info) { @@ -57,6 +58,9 @@ public DuplicateMappingException(SerializationInfo info, StreamingContext contex } } +#pragma warning disable CS0809 + // Since v5.6 + [Obsolete("This API supports obsolete formatter-based serialization and will be removed in a future version")] [SecurityCritical] public override void GetObjectData(SerializationInfo info, StreamingContext context) { @@ -64,6 +68,7 @@ public override void GetObjectData(SerializationInfo info, StreamingContext cont info.AddValue("Type", Type); info.AddValue("Name", Name); } +#pragma warning restore CS0809 /// /// The type of the duplicated object diff --git a/src/NHibernate/Exceptions/ADOConnectionException.cs b/src/NHibernate/Exceptions/ADOConnectionException.cs index 94611a6d5d9..b52f0c21e97 100644 --- a/src/NHibernate/Exceptions/ADOConnectionException.cs +++ b/src/NHibernate/Exceptions/ADOConnectionException.cs @@ -10,6 +10,8 @@ namespace NHibernate.Exceptions [Serializable] public class ADOConnectionException : ADOException { + // Since v5.6 + [Obsolete("This API supports obsolete formatter-based serialization and will be removed in a future version")] public ADOConnectionException(SerializationInfo info, StreamingContext context) : base(info, context) {} public ADOConnectionException(string message, Exception innerException, string sql) : base(message, innerException, sql) {} public ADOConnectionException(string message, Exception innerException) : base(message, innerException) {} diff --git a/src/NHibernate/Exceptions/AggregateHibernateException.cs b/src/NHibernate/Exceptions/AggregateHibernateException.cs index d33b41a6d2d..8424bd65845 100644 --- a/src/NHibernate/Exceptions/AggregateHibernateException.cs +++ b/src/NHibernate/Exceptions/AggregateHibernateException.cs @@ -81,17 +81,23 @@ private AggregateHibernateException(string message, IList innerExcept /// /// The that contains contextual information about the source or destination. /// + // Since v5.6 + [Obsolete("This API supports obsolete formatter-based serialization and will be removed in a future version")] protected AggregateHibernateException(SerializationInfo info, StreamingContext context) : base(info, context) { InnerExceptions = (ReadOnlyCollection) info.GetValue("InnerExceptions", typeof(ReadOnlyCollection)); } +#pragma warning disable CS0809 + // Since v5.6 + [Obsolete("This API supports obsolete formatter-based serialization and will be removed in a future version")] [SecurityCritical] public override void GetObjectData(SerializationInfo info, StreamingContext context) { base.GetObjectData(info, context); info.AddValue("InnerExceptions", InnerExceptions); } +#pragma warning restore CS0809 /// /// Return a string representation of the aggregate exception. diff --git a/src/NHibernate/Exceptions/ConstraintViolationException.cs b/src/NHibernate/Exceptions/ConstraintViolationException.cs index 0e933f3b4f3..0485bcc2d03 100644 --- a/src/NHibernate/Exceptions/ConstraintViolationException.cs +++ b/src/NHibernate/Exceptions/ConstraintViolationException.cs @@ -23,8 +23,9 @@ public ConstraintViolationException(string message, Exception innerException, st ConstraintName = constraintName; } - public ConstraintViolationException(SerializationInfo info, StreamingContext context) - : base(info, context) + // Since v5.6 + [Obsolete("This API supports obsolete formatter-based serialization and will be removed in a future version")] + public ConstraintViolationException(SerializationInfo info, StreamingContext context) : base(info, context) { foreach (var entry in info) { @@ -35,12 +36,16 @@ public ConstraintViolationException(SerializationInfo info, StreamingContext con } } +#pragma warning disable CS0809 + // Since v5.6 + [Obsolete("This API supports obsolete formatter-based serialization and will be removed in a future version")] [SecurityCritical] public override void GetObjectData(SerializationInfo info, StreamingContext context) { base.GetObjectData(info, context); info.AddValue("ConstraintName", ConstraintName); } +#pragma warning restore CS0809 /// /// Returns the name of the violated constraint, if known. diff --git a/src/NHibernate/Exceptions/DataException.cs b/src/NHibernate/Exceptions/DataException.cs index 99357d5e194..bfcc749da65 100644 --- a/src/NHibernate/Exceptions/DataException.cs +++ b/src/NHibernate/Exceptions/DataException.cs @@ -11,6 +11,8 @@ namespace NHibernate.Exceptions [Serializable] public class DataException : ADOException { + // Since v5.6 + [Obsolete("This API supports obsolete formatter-based serialization and will be removed in a future version")] public DataException(SerializationInfo info, StreamingContext context) : base(info, context) {} public DataException(string message, Exception innerException, string sql) : base(message, innerException, sql) {} public DataException(string message, Exception innerException) : base(message, innerException) {} diff --git a/src/NHibernate/Exceptions/GenericADOException.cs b/src/NHibernate/Exceptions/GenericADOException.cs index b82dcfeb2b1..fd93ab85d30 100644 --- a/src/NHibernate/Exceptions/GenericADOException.cs +++ b/src/NHibernate/Exceptions/GenericADOException.cs @@ -10,6 +10,8 @@ public class GenericADOException : ADOException public GenericADOException() { } + // Since v5.6 + [Obsolete("This API supports obsolete formatter-based serialization and will be removed in a future version")] public GenericADOException(SerializationInfo info, StreamingContext context) : base(info, context) { } public GenericADOException(string message, Exception innerException, string sql) : base(message, innerException, sql) { } public GenericADOException(string message, Exception innerException) : base(message, innerException) { } diff --git a/src/NHibernate/Exceptions/LockAcquisitionException.cs b/src/NHibernate/Exceptions/LockAcquisitionException.cs index 58a774b13f6..67bf824d065 100644 --- a/src/NHibernate/Exceptions/LockAcquisitionException.cs +++ b/src/NHibernate/Exceptions/LockAcquisitionException.cs @@ -10,6 +10,8 @@ namespace NHibernate.Exceptions [Serializable] public class LockAcquisitionException : ADOException { + // Since v5.6 + [Obsolete("This API supports obsolete formatter-based serialization and will be removed in a future version")] public LockAcquisitionException(SerializationInfo info, StreamingContext context) : base(info, context) {} public LockAcquisitionException(string message, Exception innerException, string sql) : base(message, innerException, sql) {} public LockAcquisitionException(string message, Exception innerException) : base(message, innerException) {} diff --git a/src/NHibernate/Exceptions/SQLGrammarException.cs b/src/NHibernate/Exceptions/SQLGrammarException.cs index 29f655daac8..1b9821e899a 100644 --- a/src/NHibernate/Exceptions/SQLGrammarException.cs +++ b/src/NHibernate/Exceptions/SQLGrammarException.cs @@ -10,6 +10,8 @@ namespace NHibernate.Exceptions [Serializable] public class SQLGrammarException : ADOException { + // Since v5.6 + [Obsolete("This API supports obsolete formatter-based serialization and will be removed in a future version")] public SQLGrammarException(SerializationInfo info, StreamingContext context) : base(info, context) {} public SQLGrammarException(string message, Exception innerException, string sql) : base(message, innerException, sql) {} public SQLGrammarException(string message, Exception innerException) : base(message, innerException) {} diff --git a/src/NHibernate/Exceptions/SqlParseException.cs b/src/NHibernate/Exceptions/SqlParseException.cs index 758b3414afa..4b5a5ba6af2 100644 --- a/src/NHibernate/Exceptions/SqlParseException.cs +++ b/src/NHibernate/Exceptions/SqlParseException.cs @@ -10,6 +10,8 @@ public SqlParseException(string message) : base(message) { } + // Since v5.6 + [Obsolete("This API supports obsolete formatter-based serialization and will be removed in a future version")] protected SqlParseException(SerializationInfo info, StreamingContext context) : base(info, context) { } diff --git a/src/NHibernate/FKUnmatchingColumnsException.cs b/src/NHibernate/FKUnmatchingColumnsException.cs index 1a0c2996f5f..531bdaf1a5c 100644 --- a/src/NHibernate/FKUnmatchingColumnsException.cs +++ b/src/NHibernate/FKUnmatchingColumnsException.cs @@ -43,8 +43,9 @@ public FKUnmatchingColumnsException(string message, Exception innerException) /// /// The that contains contextual information about the source or destination. /// - protected FKUnmatchingColumnsException(SerializationInfo info, StreamingContext context) - : base(info, context) + // Since v5.6 + [Obsolete("This API supports obsolete formatter-based serialization and will be removed in a future version")] + protected FKUnmatchingColumnsException(SerializationInfo info, StreamingContext context) : base(info, context) { } } diff --git a/src/NHibernate/HibernateException.cs b/src/NHibernate/HibernateException.cs index bc029882c25..1a3fe1d2131 100644 --- a/src/NHibernate/HibernateException.cs +++ b/src/NHibernate/HibernateException.cs @@ -63,8 +63,10 @@ public HibernateException(string message, Exception innerException) : base(messa /// /// The that contains contextual information about the source or destination. /// + // Since v5.6 + [Obsolete("This API supports obsolete formatter-based serialization and will be removed in a future version")] protected HibernateException(SerializationInfo info, StreamingContext context) : base(info, context) { } } -} \ No newline at end of file +} diff --git a/src/NHibernate/Hql/Ast/ANTLR/DetailedSemanticException.cs b/src/NHibernate/Hql/Ast/ANTLR/DetailedSemanticException.cs index 4e01696df12..8dd5e6a13da 100644 --- a/src/NHibernate/Hql/Ast/ANTLR/DetailedSemanticException.cs +++ b/src/NHibernate/Hql/Ast/ANTLR/DetailedSemanticException.cs @@ -15,6 +15,8 @@ public DetailedSemanticException(string message, Exception inner) { } + // Since v5.6 + [Obsolete("This API supports obsolete formatter-based serialization and will be removed in a future version")] protected DetailedSemanticException(SerializationInfo info, StreamingContext context) : base(info, context) { } diff --git a/src/NHibernate/Hql/Ast/ANTLR/InvalidPathException.cs b/src/NHibernate/Hql/Ast/ANTLR/InvalidPathException.cs index 6ca3a9b75c4..77903067fc2 100644 --- a/src/NHibernate/Hql/Ast/ANTLR/InvalidPathException.cs +++ b/src/NHibernate/Hql/Ast/ANTLR/InvalidPathException.cs @@ -15,6 +15,8 @@ public InvalidPathException(string s) : base(s) { } + // Since v5.6 + [Obsolete("This API supports obsolete formatter-based serialization and will be removed in a future version")] protected InvalidPathException(SerializationInfo info, StreamingContext context) : base(info, context) { } diff --git a/src/NHibernate/Hql/Ast/ANTLR/InvalidWithClauseException.cs b/src/NHibernate/Hql/Ast/ANTLR/InvalidWithClauseException.cs index 119e5c8163a..caacf575621 100644 --- a/src/NHibernate/Hql/Ast/ANTLR/InvalidWithClauseException.cs +++ b/src/NHibernate/Hql/Ast/ANTLR/InvalidWithClauseException.cs @@ -11,6 +11,8 @@ protected InvalidWithClauseException() {} public InvalidWithClauseException(string message) : base(message) {} public InvalidWithClauseException(string message, Exception inner) : base(message, inner) {} + // Since v5.6 + [Obsolete("This API supports obsolete formatter-based serialization and will be removed in a future version")] protected InvalidWithClauseException(SerializationInfo info, StreamingContext context) : base(info, context) {} } -} \ No newline at end of file +} diff --git a/src/NHibernate/Hql/Ast/ANTLR/QuerySyntaxException.cs b/src/NHibernate/Hql/Ast/ANTLR/QuerySyntaxException.cs index 252a99416f5..cd588ac2cb5 100644 --- a/src/NHibernate/Hql/Ast/ANTLR/QuerySyntaxException.cs +++ b/src/NHibernate/Hql/Ast/ANTLR/QuerySyntaxException.cs @@ -15,6 +15,8 @@ public QuerySyntaxException(string message, string hql, Exception inner) : base( public QuerySyntaxException(string message) : base(message) {} public QuerySyntaxException(string message, Exception inner) : base(message, inner) {} + // Since v5.6 + [Obsolete("This API supports obsolete formatter-based serialization and will be removed in a future version")] protected QuerySyntaxException(SerializationInfo info, StreamingContext context) : base(info, context) {} public static QuerySyntaxException Convert(RecognitionException e) diff --git a/src/NHibernate/Hql/Ast/ANTLR/SemanticException.cs b/src/NHibernate/Hql/Ast/ANTLR/SemanticException.cs index e30b7aabb4b..9b280edc7e4 100644 --- a/src/NHibernate/Hql/Ast/ANTLR/SemanticException.cs +++ b/src/NHibernate/Hql/Ast/ANTLR/SemanticException.cs @@ -15,6 +15,8 @@ public SemanticException(string message, Exception inner) { } + // Since v5.6 + [Obsolete("This API supports obsolete formatter-based serialization and will be removed in a future version")] protected SemanticException(SerializationInfo info, StreamingContext context) : base(info, context) { } diff --git a/src/NHibernate/Hql/QueryExecutionRequestException.cs b/src/NHibernate/Hql/QueryExecutionRequestException.cs index c471d5f55ce..ee112c25819 100644 --- a/src/NHibernate/Hql/QueryExecutionRequestException.cs +++ b/src/NHibernate/Hql/QueryExecutionRequestException.cs @@ -10,6 +10,8 @@ public QueryExecutionRequestException(string message, string queryString) : base { } + // Since v5.6 + [Obsolete("This API supports obsolete formatter-based serialization and will be removed in a future version")] protected QueryExecutionRequestException(SerializationInfo info, StreamingContext context) : base(info, context) { } diff --git a/src/NHibernate/Id/IdentifierGenerationException.cs b/src/NHibernate/Id/IdentifierGenerationException.cs index 1d76d44aec3..cb781005039 100644 --- a/src/NHibernate/Id/IdentifierGenerationException.cs +++ b/src/NHibernate/Id/IdentifierGenerationException.cs @@ -48,8 +48,10 @@ public IdentifierGenerationException(string message, Exception e) : base(message /// /// The that contains contextual information about the source or destination. /// + // Since v5.6 + [Obsolete("This API supports obsolete formatter-based serialization and will be removed in a future version")] protected IdentifierGenerationException(SerializationInfo info, StreamingContext context) : base(info, context) { } } -} \ No newline at end of file +} diff --git a/src/NHibernate/InstantiationException.cs b/src/NHibernate/InstantiationException.cs index 08496bffdc2..df7a57c41cd 100644 --- a/src/NHibernate/InstantiationException.cs +++ b/src/NHibernate/InstantiationException.cs @@ -74,11 +74,14 @@ public override string Message /// /// The that contains contextual information about the source or destination. /// + // Since v5.6 + [Obsolete("This API supports obsolete formatter-based serialization and will be removed in a future version")] protected InstantiationException(SerializationInfo info, StreamingContext context) : base(info, context) { this.type = info.GetValue("type", typeof(System.Type)) as System.Type; } +#pragma warning disable CS0809 /// /// Sets the serialization info for after /// getting the info from the base Exception. @@ -90,12 +93,15 @@ protected InstantiationException(SerializationInfo info, StreamingContext contex /// /// The that contains contextual information about the source or destination. /// + // Since v5.6 + [Obsolete("This API supports obsolete formatter-based serialization and will be removed in a future version")] [SecurityCritical] public override void GetObjectData(SerializationInfo info, StreamingContext context) { base.GetObjectData(info, context); info.AddValue("type", type, typeof(System.Type)); } +#pragma warning restore CS0809 #endregion } diff --git a/src/NHibernate/InvalidProxyTypeException.cs b/src/NHibernate/InvalidProxyTypeException.cs index 946478379ba..8eb770cf2e5 100644 --- a/src/NHibernate/InvalidProxyTypeException.cs +++ b/src/NHibernate/InvalidProxyTypeException.cs @@ -36,18 +36,23 @@ private static string FormatMessage(IEnumerable errors) #region Serialization - public InvalidProxyTypeException(SerializationInfo info, StreamingContext context) - : base(info, context) + // Since v5.6 + [Obsolete("This API supports obsolete formatter-based serialization and will be removed in a future version")] + public InvalidProxyTypeException(SerializationInfo info, StreamingContext context) : base(info, context) { - Errors = (ICollection)info.GetValue("errors", typeof(ICollection)); + Errors = (ICollection) info.GetValue("errors", typeof(ICollection)); } +#pragma warning disable CS0809 + // Since v5.6 + [Obsolete("This API supports obsolete formatter-based serialization and will be removed in a future version")] [SecurityCritical] public override void GetObjectData(SerializationInfo info, StreamingContext context) { base.GetObjectData(info, context); info.AddValue("errors", Errors, typeof (ICollection)); } +#pragma warning restore CS0809 #endregion } diff --git a/src/NHibernate/LazyInitializationException.cs b/src/NHibernate/LazyInitializationException.cs index 83cf6123541..0bbbb3e838b 100644 --- a/src/NHibernate/LazyInitializationException.cs +++ b/src/NHibernate/LazyInitializationException.cs @@ -74,6 +74,8 @@ public LazyInitializationException(string message, Exception innerException) : b /// /// The that contains contextual information about the source or destination. /// + // Since v5.6 + [Obsolete("This API supports obsolete formatter-based serialization and will be removed in a future version")] protected LazyInitializationException(SerializationInfo info, StreamingContext context) : base(info, context) { foreach (var entry in info) @@ -89,6 +91,9 @@ protected LazyInitializationException(SerializationInfo info, StreamingContext c } } +#pragma warning disable CS0809 + // Since v5.6 + [Obsolete("This API supports obsolete formatter-based serialization and will be removed in a future version")] [SecurityCritical] public override void GetObjectData(SerializationInfo info, StreamingContext context) { @@ -96,5 +101,6 @@ public override void GetObjectData(SerializationInfo info, StreamingContext cont info.AddValue("EntityName", EntityName); info.AddValue("EntityId", EntityId, typeof(object)); } +#pragma warning restore CS0809 } } diff --git a/src/NHibernate/MappingException.cs b/src/NHibernate/MappingException.cs index b02ed5dc0b0..2d4226158d0 100644 --- a/src/NHibernate/MappingException.cs +++ b/src/NHibernate/MappingException.cs @@ -57,9 +57,10 @@ public MappingException(string message, Exception innerException) /// /// The that contains contextual information about the source or destination. /// - protected MappingException(SerializationInfo info, StreamingContext context) - : base(info, context) + // Since v5.6 + [Obsolete("This API supports obsolete formatter-based serialization and will be removed in a future version")] + protected MappingException(SerializationInfo info, StreamingContext context) : base(info, context) { } } -} \ No newline at end of file +} diff --git a/src/NHibernate/NHibernate.csproj b/src/NHibernate/NHibernate.csproj index 463078ec0dc..7440dc9429e 100644 --- a/src/NHibernate/NHibernate.csproj +++ b/src/NHibernate/NHibernate.csproj @@ -54,6 +54,10 @@ + + + + diff --git a/src/NHibernate/NonUniqueObjectException.cs b/src/NHibernate/NonUniqueObjectException.cs index ba7f60e4ffc..ba695cb8bb0 100644 --- a/src/NHibernate/NonUniqueObjectException.cs +++ b/src/NHibernate/NonUniqueObjectException.cs @@ -61,13 +61,15 @@ public string EntityName /// /// Initializes a new instance of the class. /// - protected NonUniqueObjectException(SerializationInfo info, StreamingContext context) - : base(info, context) + // Since v5.6 + [Obsolete("This API supports obsolete formatter-based serialization and will be removed in a future version")] + protected NonUniqueObjectException(SerializationInfo info, StreamingContext context) : base(info, context) { identifier = info.GetValue("identifier", typeof(Object)); entityName = info.GetValue("entityName", typeof(string)) as string; } +#pragma warning disable CS0809 /// /// Sets the serialization info for after /// getting the info from the base Exception. @@ -79,6 +81,8 @@ protected NonUniqueObjectException(SerializationInfo info, StreamingContext cont /// /// The that contains contextual information about the source or destination. /// + // Since v5.6 + [Obsolete("This API supports obsolete formatter-based serialization and will be removed in a future version")] [SecurityCritical] public override void GetObjectData(SerializationInfo info, StreamingContext context) { @@ -86,6 +90,7 @@ public override void GetObjectData(SerializationInfo info, StreamingContext cont info.AddValue("identifier", identifier, typeof(Object)); info.AddValue("entityName", entityName, typeof(string)); } +#pragma warning restore CS0809 #endregion } diff --git a/src/NHibernate/NonUniqueResultException.cs b/src/NHibernate/NonUniqueResultException.cs index 82ff46f6de5..81038d8e157 100644 --- a/src/NHibernate/NonUniqueResultException.cs +++ b/src/NHibernate/NonUniqueResultException.cs @@ -32,8 +32,9 @@ public NonUniqueResultException(int resultCount) /// /// The that contains contextual information about the source or destination. /// - protected NonUniqueResultException(SerializationInfo info, StreamingContext context) - : base(info, context) + // Since v5.6 + [Obsolete("This API supports obsolete formatter-based serialization and will be removed in a future version")] + protected NonUniqueResultException(SerializationInfo info, StreamingContext context) : base(info, context) { } } diff --git a/src/NHibernate/ObjectDeletedException.cs b/src/NHibernate/ObjectDeletedException.cs index c3ee6a853c6..b763a97ba92 100644 --- a/src/NHibernate/ObjectDeletedException.cs +++ b/src/NHibernate/ObjectDeletedException.cs @@ -30,10 +30,12 @@ public ObjectDeletedException(string message, object identifier, string clazz) /// /// The that contains contextual information about the source or destination. /// + // Since v5.6 + [Obsolete("This API supports obsolete formatter-based serialization and will be removed in a future version")] protected ObjectDeletedException(SerializationInfo info, StreamingContext context) : base(info, context) { } #endregion } -} \ No newline at end of file +} diff --git a/src/NHibernate/ObjectNotFoundByUniqueKeyException.cs b/src/NHibernate/ObjectNotFoundByUniqueKeyException.cs index f61442aaefc..9ffb72c47f3 100644 --- a/src/NHibernate/ObjectNotFoundByUniqueKeyException.cs +++ b/src/NHibernate/ObjectNotFoundByUniqueKeyException.cs @@ -36,13 +36,17 @@ public ObjectNotFoundByUniqueKeyException(string entityName, string propertyName #region Serialization - protected ObjectNotFoundByUniqueKeyException(SerializationInfo info, StreamingContext context) - : base(info, context) + // Since v5.6 + [Obsolete("This API supports obsolete formatter-based serialization and will be removed in a future version")] + protected ObjectNotFoundByUniqueKeyException(SerializationInfo info, StreamingContext context) : base(info, context) { Key = info.GetValue(nameof(Key), typeof(object)); PropertyName = info.GetString(nameof(PropertyName)); } +#pragma warning disable CS0809 + // Since v5.6 + [Obsolete("This API supports obsolete formatter-based serialization and will be removed in a future version")] [SecurityCritical] public override void GetObjectData(SerializationInfo info, StreamingContext context) { @@ -50,6 +54,7 @@ public override void GetObjectData(SerializationInfo info, StreamingContext cont info.AddValue(nameof(Key), Key); info.AddValue(nameof(PropertyName), PropertyName); } +#pragma warning restore CS0809 #endregion Serialization } diff --git a/src/NHibernate/ObjectNotFoundException.cs b/src/NHibernate/ObjectNotFoundException.cs index d09447b44b8..71fb3705c4e 100644 --- a/src/NHibernate/ObjectNotFoundException.cs +++ b/src/NHibernate/ObjectNotFoundException.cs @@ -38,10 +38,12 @@ public ObjectNotFoundException(object identifier, string entityName) : base(iden /// /// The that contains contextual information about the source or destination. /// + // Since v5.6 + [Obsolete("This API supports obsolete formatter-based serialization and will be removed in a future version")] protected ObjectNotFoundException(SerializationInfo info, StreamingContext context) : base(info, context) { } #endregion } -} \ No newline at end of file +} diff --git a/src/NHibernate/PersistentObjectException.cs b/src/NHibernate/PersistentObjectException.cs index 0a3d7cc7563..e6384138424 100644 --- a/src/NHibernate/PersistentObjectException.cs +++ b/src/NHibernate/PersistentObjectException.cs @@ -29,8 +29,10 @@ public PersistentObjectException(string message) : base(message) /// /// The that contains contextual information about the source or destination. /// + // Since v5.6 + [Obsolete("This API supports obsolete formatter-based serialization and will be removed in a future version")] protected PersistentObjectException(SerializationInfo info, StreamingContext context) : base(info, context) { } } -} \ No newline at end of file +} diff --git a/src/NHibernate/PropertyAccessException.cs b/src/NHibernate/PropertyAccessException.cs index 47666cd249a..66f9608698d 100644 --- a/src/NHibernate/PropertyAccessException.cs +++ b/src/NHibernate/PropertyAccessException.cs @@ -81,6 +81,8 @@ public override string Message /// /// The that contains contextual information about the source or destination. /// + // Since v5.6 + [Obsolete("This API supports obsolete formatter-based serialization and will be removed in a future version")] protected PropertyAccessException(SerializationInfo info, StreamingContext context) : base(info, context) { persistentType = info.GetValue("persistentType", typeof(System.Type)) as System.Type; @@ -88,6 +90,7 @@ protected PropertyAccessException(SerializationInfo info, StreamingContext conte wasSetter = info.GetBoolean("wasSetter"); } +#pragma warning disable CS0809 /// /// Sets the serialization info for after /// getting the info from the base Exception. @@ -99,6 +102,8 @@ protected PropertyAccessException(SerializationInfo info, StreamingContext conte /// /// The that contains contextual information about the source or destination. /// + // Since v5.6 + [Obsolete("This API supports obsolete formatter-based serialization and will be removed in a future version")] [SecurityCritical] public override void GetObjectData(SerializationInfo info, StreamingContext context) { @@ -107,7 +112,8 @@ public override void GetObjectData(SerializationInfo info, StreamingContext cont info.AddValue("propertyName", propertyName); info.AddValue("wasSetter", wasSetter); } +#pragma warning restore CS0809 #endregion } -} \ No newline at end of file +} diff --git a/src/NHibernate/PropertyNotFoundException.cs b/src/NHibernate/PropertyNotFoundException.cs index d64108eaae3..3a13d5eb256 100644 --- a/src/NHibernate/PropertyNotFoundException.cs +++ b/src/NHibernate/PropertyNotFoundException.cs @@ -59,8 +59,9 @@ public PropertyNotFoundException(string propertyName, string fieldName, System.T /// /// The that contains contextual information about the source or destination. /// - protected PropertyNotFoundException(SerializationInfo info, StreamingContext context) - : base(info, context) + // Since v5.6 + [Obsolete("This API supports obsolete formatter-based serialization and will be removed in a future version")] + protected PropertyNotFoundException(SerializationInfo info, StreamingContext context) : base(info, context) { foreach (var entry in info) { @@ -81,6 +82,9 @@ protected PropertyNotFoundException(SerializationInfo info, StreamingContext con } } +#pragma warning disable CS0809 + // Since v5.6 + [Obsolete("This API supports obsolete formatter-based serialization and will be removed in a future version")] [SecurityCritical] public override void GetObjectData(SerializationInfo info, StreamingContext context) { @@ -89,6 +93,7 @@ public override void GetObjectData(SerializationInfo info, StreamingContext cont info.AddValue("PropertyName", PropertyName); info.AddValue("AccessorType", AccessorType); } +#pragma warning restore CS0809 public System.Type TargetType { get; } diff --git a/src/NHibernate/PropertyValueException.cs b/src/NHibernate/PropertyValueException.cs index c58d57ed75f..fe62bd72b83 100644 --- a/src/NHibernate/PropertyValueException.cs +++ b/src/NHibernate/PropertyValueException.cs @@ -64,13 +64,15 @@ public override string Message /// /// The that contains contextual information about the source or destination. /// - protected PropertyValueException(SerializationInfo info, StreamingContext context) - : base(info, context) + // Since v5.6 + [Obsolete("This API supports obsolete formatter-based serialization and will be removed in a future version")] + protected PropertyValueException(SerializationInfo info, StreamingContext context) : base(info, context) { entityName = info.GetValue("entityName", typeof(string)) as string; propertyName = info.GetString("propertyName"); } +#pragma warning disable CS0809 /// /// Sets the serialization info for after /// getting the info from the base Exception. @@ -82,6 +84,8 @@ protected PropertyValueException(SerializationInfo info, StreamingContext contex /// /// The that contains contextual information about the source or destination. /// + // Since v5.6 + [Obsolete("This API supports obsolete formatter-based serialization and will be removed in a future version")] [SecurityCritical] public override void GetObjectData(SerializationInfo info, StreamingContext context) { @@ -89,6 +93,7 @@ public override void GetObjectData(SerializationInfo info, StreamingContext cont info.AddValue("entityName", entityName); info.AddValue("propertyName", propertyName); } +#pragma warning restore CS0809 #endregion } diff --git a/src/NHibernate/QueryException.cs b/src/NHibernate/QueryException.cs index ff16cad0489..e26275d950e 100644 --- a/src/NHibernate/QueryException.cs +++ b/src/NHibernate/QueryException.cs @@ -112,11 +112,14 @@ public override string Message /// /// The that contains contextual information about the source or destination. /// + // Since v5.6 + [Obsolete("This API supports obsolete formatter-based serialization and will be removed in a future version")] protected QueryException(SerializationInfo info, StreamingContext context) : base(info, context) { queryString = info.GetString("queryString"); } +#pragma warning disable CS0809 /// /// Sets the serialization info for after /// getting the info from the base Exception. @@ -128,12 +131,15 @@ protected QueryException(SerializationInfo info, StreamingContext context) : bas /// /// The that contains contextual information about the source or destination. /// + // Since v5.6 + [Obsolete("This API supports obsolete formatter-based serialization and will be removed in a future version")] [SecurityCritical] public override void GetObjectData(SerializationInfo info, StreamingContext context) { base.GetObjectData(info, context); info.AddValue("queryString", queryString, typeof(String)); } +#pragma warning restore CS0809 #endregion } diff --git a/src/NHibernate/QueryParameterException.cs b/src/NHibernate/QueryParameterException.cs index 959ab847de4..7948b0549b1 100644 --- a/src/NHibernate/QueryParameterException.cs +++ b/src/NHibernate/QueryParameterException.cs @@ -9,6 +9,8 @@ public class QueryParameterException : QueryException // TODO : without default constructor can't be serialized public QueryParameterException(string message) : base(message) { } public QueryParameterException(string message, Exception inner) : base(message, inner) { } + // Since v5.6 + [Obsolete("This API supports obsolete formatter-based serialization and will be removed in a future version")] protected QueryParameterException(SerializationInfo info,StreamingContext context): base(info, context) { } } } diff --git a/src/NHibernate/SchemaValidationException.cs b/src/NHibernate/SchemaValidationException.cs index 2d654a07583..fdb2d0bc1b6 100644 --- a/src/NHibernate/SchemaValidationException.cs +++ b/src/NHibernate/SchemaValidationException.cs @@ -16,17 +16,23 @@ public SchemaValidationException(string msg, IList validationErrors) : b ValidationErrors = new ReadOnlyCollection(validationErrors); } + // Since v5.6 + [Obsolete("This API supports obsolete formatter-based serialization and will be removed in a future version")] protected SchemaValidationException(SerializationInfo info, StreamingContext context) : base(info, context) { ValidationErrors = (ReadOnlyCollection) info.GetValue("ValidationErrors", typeof(ReadOnlyCollection)); } +#pragma warning disable CS0809 + // Since v5.6 + [Obsolete("This API supports obsolete formatter-based serialization and will be removed in a future version")] [SecurityCritical] public override void GetObjectData(SerializationInfo info, StreamingContext context) { base.GetObjectData(info, context); info.AddValue("ValidationErrors", ValidationErrors); } +#pragma warning restore CS0809 } } diff --git a/src/NHibernate/SessionException.cs b/src/NHibernate/SessionException.cs index 96ce8ccc697..0c082fcb9ce 100644 --- a/src/NHibernate/SessionException.cs +++ b/src/NHibernate/SessionException.cs @@ -11,8 +11,9 @@ public SessionException(string message) { } - protected SessionException(SerializationInfo info, StreamingContext context) - : base(info, context) + // Since v5.6 + [Obsolete("This API supports obsolete formatter-based serialization and will be removed in a future version")] + protected SessionException(SerializationInfo info, StreamingContext context) : base(info, context) { } } diff --git a/src/NHibernate/StaleObjectStateException.cs b/src/NHibernate/StaleObjectStateException.cs index b53e0155f53..a7e1d8f10cf 100644 --- a/src/NHibernate/StaleObjectStateException.cs +++ b/src/NHibernate/StaleObjectStateException.cs @@ -80,12 +80,15 @@ public override string Message /// /// The that contains contextual information about the source or destination. /// + // Since v5.6 + [Obsolete("This API supports obsolete formatter-based serialization and will be removed in a future version")] protected StaleObjectStateException(SerializationInfo info, StreamingContext context) : base(info, context) { entityName = info.GetValue("entityName", typeof(string)) as string; identifier = info.GetValue("identifier", typeof(object)); } +#pragma warning disable CS0809 /// /// Sets the serialization info for after /// getting the info from the base Exception. @@ -97,6 +100,8 @@ protected StaleObjectStateException(SerializationInfo info, StreamingContext con /// /// The that contains contextual information about the source or destination. /// + // Since v5.6 + [Obsolete("This API supports obsolete formatter-based serialization and will be removed in a future version")] [SecurityCritical] public override void GetObjectData(SerializationInfo info, StreamingContext context) { @@ -104,6 +109,7 @@ public override void GetObjectData(SerializationInfo info, StreamingContext cont info.AddValue("entityName", entityName, typeof(string)); info.AddValue("identifier", identifier, typeof(object)); } +#pragma warning restore CS0809 #endregion } diff --git a/src/NHibernate/StaleStateException.cs b/src/NHibernate/StaleStateException.cs index 2a08cc4e9be..b64ba058b6f 100644 --- a/src/NHibernate/StaleStateException.cs +++ b/src/NHibernate/StaleStateException.cs @@ -13,8 +13,9 @@ public StaleStateException(string message, Exception innerException) : base(mess { } - protected StaleStateException(SerializationInfo info, StreamingContext context) - : base(info, context) + // Since v5.6 + [Obsolete("This API supports obsolete formatter-based serialization and will be removed in a future version")] + protected StaleStateException(SerializationInfo info, StreamingContext context) : base(info, context) { } } diff --git a/src/NHibernate/TransactionException.cs b/src/NHibernate/TransactionException.cs index e5964844593..f9a91236492 100644 --- a/src/NHibernate/TransactionException.cs +++ b/src/NHibernate/TransactionException.cs @@ -41,8 +41,10 @@ public TransactionException(string message, Exception innerException) : base(mes /// /// The that contains contextual information about the source or destination. /// + // Since v5.6 + [Obsolete("This API supports obsolete formatter-based serialization and will be removed in a future version")] protected TransactionException(SerializationInfo info, StreamingContext context) : base(info, context) { } } -} \ No newline at end of file +} diff --git a/src/NHibernate/TransientObjectException.cs b/src/NHibernate/TransientObjectException.cs index eb55554248e..42e1eb10da3 100644 --- a/src/NHibernate/TransientObjectException.cs +++ b/src/NHibernate/TransientObjectException.cs @@ -29,8 +29,10 @@ public TransientObjectException(string message) : base(message) /// /// The that contains contextual information about the source or destination. /// + // Since v5.6 + [Obsolete("This API supports obsolete formatter-based serialization and will be removed in a future version")] protected TransientObjectException(SerializationInfo info, StreamingContext context) : base(info, context) { } } -} \ No newline at end of file +} diff --git a/src/NHibernate/Tuple/Entity/PocoEntityInstantiator.cs b/src/NHibernate/Tuple/Entity/PocoEntityInstantiator.cs index 0a4075ca643..7584c3456db 100644 --- a/src/NHibernate/Tuple/Entity/PocoEntityInstantiator.cs +++ b/src/NHibernate/Tuple/Entity/PocoEntityInstantiator.cs @@ -37,7 +37,7 @@ protected override object CreateInstance() return base.CreateInstance(); } - var entity = _proxyFactory.GetFieldInterceptionProxy(base.CreateInstance); + var entity = ProxyFactoryExtensions.GetFieldInterceptionProxy(_proxyFactory, base.CreateInstance); _entityMetamodel.BytecodeEnhancementMetadata.InjectInterceptor(entity, null); return entity; } diff --git a/src/NHibernate/Tuple/PocoInstantiator.cs b/src/NHibernate/Tuple/PocoInstantiator.cs index 6af0682e6c6..3f4258e921d 100644 --- a/src/NHibernate/Tuple/PocoInstantiator.cs +++ b/src/NHibernate/Tuple/PocoInstantiator.cs @@ -100,11 +100,13 @@ public object Instantiate() { throw new InstantiationException("Cannot instantiate abstract class or interface: ", mappedClass); } + // 6.0 TODO: Remove if statement if (generateFieldInterceptionProxy) { - return proxyFactory.GetFieldInterceptionProxy(CreateInstance); + return ProxyFactoryExtensions.GetFieldInterceptionProxy(proxyFactory, CreateInstance); } + return CreateInstance(); } diff --git a/src/NHibernate/Type/SerializationException.cs b/src/NHibernate/Type/SerializationException.cs index 1118dbf5487..18fe754d3a2 100644 --- a/src/NHibernate/Type/SerializationException.cs +++ b/src/NHibernate/Type/SerializationException.cs @@ -49,8 +49,10 @@ public SerializationException(string message, Exception e) : base(message, e) /// /// The that contains contextual information about the source or destination. /// + // Since v5.6 + [Obsolete("This API supports obsolete formatter-based serialization and will be removed in a future version")] protected SerializationException(SerializationInfo info, StreamingContext context) : base(info, context) { } } -} \ No newline at end of file +} diff --git a/src/NHibernate/TypeMismatchException.cs b/src/NHibernate/TypeMismatchException.cs index 5e511d6dadc..d3568109f01 100644 --- a/src/NHibernate/TypeMismatchException.cs +++ b/src/NHibernate/TypeMismatchException.cs @@ -11,6 +11,8 @@ public class TypeMismatchException : HibernateException { public TypeMismatchException(string message) : base(message) { } public TypeMismatchException(string message, Exception inner) : base(message, inner) { } + // Since v5.6 + [Obsolete("This API supports obsolete formatter-based serialization and will be removed in a future version")] protected TypeMismatchException(SerializationInfo info,StreamingContext context): base(info, context) { } } } diff --git a/src/NHibernate/UnresolvableObjectException.cs b/src/NHibernate/UnresolvableObjectException.cs index d766bf2881a..75be1da8251 100644 --- a/src/NHibernate/UnresolvableObjectException.cs +++ b/src/NHibernate/UnresolvableObjectException.cs @@ -92,6 +92,9 @@ public static void ThrowIfNull(object o, object id, string entityName) #region ISerializable Members +#pragma warning disable CS0809 + // Since v5.6 + [Obsolete("This API supports obsolete formatter-based serialization and will be removed in a future version")] [SecurityCritical] public override void GetObjectData(SerializationInfo info, StreamingContext context) { @@ -100,9 +103,11 @@ public override void GetObjectData(SerializationInfo info, StreamingContext cont info.AddValue("clazz", clazz); info.AddValue("entityName", entityName); } +#pragma warning restore CS0809 - protected UnresolvableObjectException(SerializationInfo info, StreamingContext context) - : base(info, context) + // Since v5.6 + [Obsolete("This API supports obsolete formatter-based serialization and will be removed in a future version")] + protected UnresolvableObjectException(SerializationInfo info, StreamingContext context) : base(info, context) { identifier = info.GetValue("identifier", typeof(object)); clazz = info.GetValue("clazz", typeof(System.Type)) as System.Type; diff --git a/src/NHibernate/Util/TypeNameParser.cs b/src/NHibernate/Util/TypeNameParser.cs index 6a56f862fb0..5d90c7bb4b5 100644 --- a/src/NHibernate/Util/TypeNameParser.cs +++ b/src/NHibernate/Util/TypeNameParser.cs @@ -12,6 +12,8 @@ public class ParserException : Exception { public ParserException(string message) : base(message) { } + // Since v5.6 + [Obsolete("This API supports obsolete formatter-based serialization and will be removed in a future version")] protected ParserException(SerializationInfo info, StreamingContext context) : base(info, context) { } diff --git a/src/NHibernate/WrongClassException.cs b/src/NHibernate/WrongClassException.cs index 90c7f1024dc..3018636d031 100644 --- a/src/NHibernate/WrongClassException.cs +++ b/src/NHibernate/WrongClassException.cs @@ -69,12 +69,15 @@ public override string Message /// /// The that contains contextual information about the source or destination. /// + // Since v5.6 + [Obsolete("This API supports obsolete formatter-based serialization and will be removed in a future version")] protected WrongClassException(SerializationInfo info, StreamingContext context) : base(info, context) { entityName = info.GetValue("entityName", typeof(string)) as string; identifier = info.GetValue("identifier", typeof(object)); } +#pragma warning disable CS0809 /// /// Sets the serialization info for after /// getting the info from the base Exception. @@ -86,6 +89,8 @@ protected WrongClassException(SerializationInfo info, StreamingContext context) /// /// The that contains contextual information about the source or destination. /// + // Since v5.6 + [Obsolete("This API supports obsolete formatter-based serialization and will be removed in a future version")] [SecurityCritical] public override void GetObjectData(SerializationInfo info, StreamingContext context) { @@ -93,6 +98,7 @@ public override void GetObjectData(SerializationInfo info, StreamingContext cont info.AddValue("entityName", entityName, typeof(string)); info.AddValue("identifier", identifier, typeof(object)); } +#pragma warning restore CS0809 #endregion }