From 9627c11e5cd7d18e2bc90799db87fd0d19b7a11c Mon Sep 17 00:00:00 2001 From: Alex Zaytsev Date: Fri, 1 Mar 2024 11:16:30 +1000 Subject: [PATCH 1/9] Add .net 8.0 target --- ShowBuildMenu.sh | 4 ++-- Tools/BuildTool/BuildTool.csproj | 2 +- build-common/NHibernate.props | 5 +++-- global.json | 2 +- psake.ps1 | 2 +- src/AsyncGenerator.yml | 2 +- .../NHibernate.Test.VisualBasic.vbproj | 6 +++--- src/NHibernate.Test/NHibernate.Test.csproj | 12 ++++++------ .../NHibernate.TestDatabaseSetup.csproj | 4 ++-- src/NHibernate.sln | 1 + src/NHibernate/ADOException.cs | 4 ++++ .../AdoNet/TooManyRowsAffectedException.cs | 7 +++++-- src/NHibernate/AssertionFailure.cs | 2 ++ .../Bytecode/HibernateByteCodeException.cs | 4 +++- .../Bytecode/HibernateObjectsFactoryException.cs | 2 ++ src/NHibernate/Bytecode/NotInstrumentedException.cs | 5 +++-- .../UnableToLoadProxyFactoryFactoryException.cs | 7 +++++-- src/NHibernate/Cache/CacheException.cs | 4 +++- src/NHibernate/CallbackException.cs | 2 ++ src/NHibernate/Cfg/HibernateConfigException.cs | 5 +++-- src/NHibernate/Classic/ValidationFailure.cs | 2 ++ .../Collection/Generic/SetHelpers/SetSnapShot.cs | 2 ++ src/NHibernate/DuplicateMappingException.cs | 7 +++++-- src/NHibernate/Exceptions/ADOConnectionException.cs | 2 ++ .../Exceptions/AggregateHibernateException.cs | 4 ++++ .../Exceptions/ConstraintViolationException.cs | 7 +++++-- src/NHibernate/Exceptions/DataException.cs | 2 ++ src/NHibernate/Exceptions/GenericADOException.cs | 2 ++ .../Exceptions/LockAcquisitionException.cs | 2 ++ src/NHibernate/Exceptions/SQLGrammarException.cs | 2 ++ src/NHibernate/Exceptions/SqlParseException.cs | 2 ++ src/NHibernate/FKUnmatchingColumnsException.cs | 5 +++-- src/NHibernate/HibernateException.cs | 4 +++- .../Hql/Ast/ANTLR/DetailedSemanticException.cs | 2 ++ src/NHibernate/Hql/Ast/ANTLR/InvalidPathException.cs | 2 ++ .../Hql/Ast/ANTLR/InvalidWithClauseException.cs | 4 +++- src/NHibernate/Hql/Ast/ANTLR/QuerySyntaxException.cs | 2 ++ src/NHibernate/Hql/Ast/ANTLR/SemanticException.cs | 2 ++ src/NHibernate/Hql/QueryExecutionRequestException.cs | 2 ++ src/NHibernate/Id/IdentifierGenerationException.cs | 4 +++- src/NHibernate/InstantiationException.cs | 4 ++++ src/NHibernate/InvalidProxyTypeException.cs | 9 ++++++--- src/NHibernate/LazyInitializationException.cs | 4 ++++ src/NHibernate/MappingException.cs | 7 ++++--- src/NHibernate/NHibernate.csproj | 4 ++++ src/NHibernate/NonUniqueObjectException.cs | 7 +++++-- src/NHibernate/NonUniqueResultException.cs | 5 +++-- src/NHibernate/ObjectDeletedException.cs | 4 +++- src/NHibernate/ObjectNotFoundByUniqueKeyException.cs | 7 +++++-- src/NHibernate/ObjectNotFoundException.cs | 4 +++- src/NHibernate/PersistentObjectException.cs | 4 +++- src/NHibernate/PropertyAccessException.cs | 6 +++++- src/NHibernate/PropertyNotFoundException.cs | 7 +++++-- src/NHibernate/PropertyValueException.cs | 7 +++++-- src/NHibernate/QueryException.cs | 4 ++++ src/NHibernate/QueryParameterException.cs | 2 ++ src/NHibernate/SchemaValidationException.cs | 4 ++++ src/NHibernate/SessionException.cs | 5 +++-- src/NHibernate/StaleObjectStateException.cs | 4 ++++ src/NHibernate/StaleStateException.cs | 5 +++-- src/NHibernate/TransactionException.cs | 4 +++- src/NHibernate/TransientObjectException.cs | 4 +++- src/NHibernate/Type/SerializationException.cs | 4 +++- src/NHibernate/TypeMismatchException.cs | 2 ++ src/NHibernate/UnresolvableObjectException.cs | 7 +++++-- src/NHibernate/Util/TypeNameParser.cs | 2 ++ src/NHibernate/WrongClassException.cs | 4 ++++ 67 files changed, 206 insertions(+), 67 deletions(-) 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..2a6d3319fe1 100644 --- a/build-common/NHibernate.props +++ b/build-common/NHibernate.props @@ -14,14 +14,15 @@ $(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);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 16f7a267f14..149f4824c98 100644 --- a/psake.ps1 +++ b/psake.ps1 @@ -130,7 +130,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/NHibernate.Test.csproj b/src/NHibernate.Test/NHibernate.Test.csproj index 2ae6cf60202..6e5a4769304 100644 --- a/src/NHibernate.Test/NHibernate.Test.csproj +++ b/src/NHibernate.Test/NHibernate.Test.csproj @@ -7,7 +7,7 @@ $(NoWarn);3001;3002;3003;3005;SYSLIB0003;SYSLIB0012 true - + Exe false @@ -38,7 +38,7 @@ PreserveNewest - + @@ -63,7 +63,7 @@ - + @@ -86,10 +86,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..3da1302e6e5 100644 --- a/src/NHibernate/ADOException.cs +++ b/src/NHibernate/ADOException.cs @@ -50,11 +50,15 @@ 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)); } + // 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) { diff --git a/src/NHibernate/AdoNet/TooManyRowsAffectedException.cs b/src/NHibernate/AdoNet/TooManyRowsAffectedException.cs index bcf54ff1e63..885b1c504e4 100644 --- a/src/NHibernate/AdoNet/TooManyRowsAffectedException.cs +++ b/src/NHibernate/AdoNet/TooManyRowsAffectedException.cs @@ -18,13 +18,16 @@ 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"); } + // 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) { 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..bf0a1e49a46 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,6 +26,8 @@ protected UnableToLoadProxyFactoryFactoryException(SerializationInfo info, Strea } } + // 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) { 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..522c38c4c84 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,8 @@ public DuplicateMappingException(SerializationInfo info, StreamingContext contex } } + // 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) { 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..1200f00e4ab 100644 --- a/src/NHibernate/Exceptions/AggregateHibernateException.cs +++ b/src/NHibernate/Exceptions/AggregateHibernateException.cs @@ -81,11 +81,15 @@ 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)); } + // 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) { diff --git a/src/NHibernate/Exceptions/ConstraintViolationException.cs b/src/NHibernate/Exceptions/ConstraintViolationException.cs index 0e933f3b4f3..dee027ac25a 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,6 +36,8 @@ public ConstraintViolationException(SerializationInfo info, StreamingContext con } } + // 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) { 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..1383ce1bc3e 100644 --- a/src/NHibernate/InstantiationException.cs +++ b/src/NHibernate/InstantiationException.cs @@ -74,6 +74,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 InstantiationException(SerializationInfo info, StreamingContext context) : base(info, context) { this.type = info.GetValue("type", typeof(System.Type)) as System.Type; @@ -90,6 +92,8 @@ 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) { diff --git a/src/NHibernate/InvalidProxyTypeException.cs b/src/NHibernate/InvalidProxyTypeException.cs index 946478379ba..0d888ec949e 100644 --- a/src/NHibernate/InvalidProxyTypeException.cs +++ b/src/NHibernate/InvalidProxyTypeException.cs @@ -36,12 +36,15 @@ 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)); } + // 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) { diff --git a/src/NHibernate/LazyInitializationException.cs b/src/NHibernate/LazyInitializationException.cs index 83cf6123541..4c3f1969568 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,8 @@ protected LazyInitializationException(SerializationInfo info, StreamingContext c } } + // 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) { 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..a0b9917b3d8 100644 --- a/src/NHibernate/NonUniqueObjectException.cs +++ b/src/NHibernate/NonUniqueObjectException.cs @@ -61,8 +61,9 @@ 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; @@ -79,6 +80,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) { 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..8ccbba3a2ea 100644 --- a/src/NHibernate/ObjectNotFoundByUniqueKeyException.cs +++ b/src/NHibernate/ObjectNotFoundByUniqueKeyException.cs @@ -36,13 +36,16 @@ 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)); } + // 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) { 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..a7413b3dc23 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; @@ -99,6 +101,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) { @@ -110,4 +114,4 @@ public override void GetObjectData(SerializationInfo info, StreamingContext cont #endregion } -} \ No newline at end of file +} diff --git a/src/NHibernate/PropertyNotFoundException.cs b/src/NHibernate/PropertyNotFoundException.cs index d64108eaae3..756a0bad6ab 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,8 @@ protected PropertyNotFoundException(SerializationInfo info, StreamingContext con } } + // 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) { diff --git a/src/NHibernate/PropertyValueException.cs b/src/NHibernate/PropertyValueException.cs index c58d57ed75f..006c4cd12a6 100644 --- a/src/NHibernate/PropertyValueException.cs +++ b/src/NHibernate/PropertyValueException.cs @@ -64,8 +64,9 @@ 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"); @@ -82,6 +83,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) { diff --git a/src/NHibernate/QueryException.cs b/src/NHibernate/QueryException.cs index ff16cad0489..1c0948f0112 100644 --- a/src/NHibernate/QueryException.cs +++ b/src/NHibernate/QueryException.cs @@ -112,6 +112,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 QueryException(SerializationInfo info, StreamingContext context) : base(info, context) { queryString = info.GetString("queryString"); @@ -128,6 +130,8 @@ 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) { 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..43ed1ca321f 100644 --- a/src/NHibernate/SchemaValidationException.cs +++ b/src/NHibernate/SchemaValidationException.cs @@ -16,12 +16,16 @@ 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)); } + // 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) { 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..3e2ae54be35 100644 --- a/src/NHibernate/StaleObjectStateException.cs +++ b/src/NHibernate/StaleObjectStateException.cs @@ -80,6 +80,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 StaleObjectStateException(SerializationInfo info, StreamingContext context) : base(info, context) { entityName = info.GetValue("entityName", typeof(string)) as string; @@ -97,6 +99,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) { 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/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..35840344cb0 100644 --- a/src/NHibernate/UnresolvableObjectException.cs +++ b/src/NHibernate/UnresolvableObjectException.cs @@ -92,6 +92,8 @@ public static void ThrowIfNull(object o, object id, string entityName) #region ISerializable Members + // 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) { @@ -101,8 +103,9 @@ public override void GetObjectData(SerializationInfo info, StreamingContext cont info.AddValue("entityName", entityName); } - 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..9040d822eaa 100644 --- a/src/NHibernate/WrongClassException.cs +++ b/src/NHibernate/WrongClassException.cs @@ -69,6 +69,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 WrongClassException(SerializationInfo info, StreamingContext context) : base(info, context) { entityName = info.GetValue("entityName", typeof(string)) as string; @@ -86,6 +88,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) { From 0cb14be3b2b681cedbc94ce28d4d6e41f2fea226 Mon Sep 17 00:00:00 2001 From: Alex Zaytsev Date: Fri, 1 Mar 2024 11:41:36 +1000 Subject: [PATCH 2/9] Disable CS0809 to accomodate difference in frameworks --- build-common/NHibernate.props | 1 + src/NHibernate/ADOException.cs | 3 +++ src/NHibernate/AdoNet/TooManyRowsAffectedException.cs | 2 ++ .../Bytecode/UnableToLoadProxyFactoryFactoryException.cs | 2 ++ src/NHibernate/DuplicateMappingException.cs | 2 ++ src/NHibernate/Exceptions/AggregateHibernateException.cs | 2 ++ src/NHibernate/Exceptions/ConstraintViolationException.cs | 2 ++ src/NHibernate/InstantiationException.cs | 2 ++ src/NHibernate/InvalidProxyTypeException.cs | 2 ++ src/NHibernate/LazyInitializationException.cs | 2 ++ src/NHibernate/NonUniqueObjectException.cs | 2 ++ src/NHibernate/ObjectNotFoundByUniqueKeyException.cs | 2 ++ src/NHibernate/PropertyAccessException.cs | 2 ++ src/NHibernate/PropertyNotFoundException.cs | 2 ++ src/NHibernate/PropertyValueException.cs | 2 ++ src/NHibernate/QueryException.cs | 2 ++ src/NHibernate/SchemaValidationException.cs | 2 ++ src/NHibernate/StaleObjectStateException.cs | 2 ++ src/NHibernate/UnresolvableObjectException.cs | 2 ++ src/NHibernate/WrongClassException.cs | 2 ++ 20 files changed, 40 insertions(+) diff --git a/build-common/NHibernate.props b/build-common/NHibernate.props index 2a6d3319fe1..8cc1c463f2f 100644 --- a/build-common/NHibernate.props +++ b/build-common/NHibernate.props @@ -21,6 +21,7 @@ NETFX;$(DefineConstants) NETFX,$(DefineConstants) + $(NoWarn);NU1903 $(NoWarn);SYSLIB0011 $(NoWarn);SYSLIB0011;SYSLIB0050;SYSLIB0051 diff --git a/src/NHibernate/ADOException.cs b/src/NHibernate/ADOException.cs index 3da1302e6e5..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. /// @@ -57,6 +58,7 @@ protected ADOException(SerializationInfo info, StreamingContext context) : base( 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] @@ -65,6 +67,7 @@ public override void GetObjectData(SerializationInfo info, StreamingContext cont 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 885b1c504e4..e113040c659 100644 --- a/src/NHibernate/AdoNet/TooManyRowsAffectedException.cs +++ b/src/NHibernate/AdoNet/TooManyRowsAffectedException.cs @@ -26,6 +26,7 @@ protected TooManyRowsAffectedException(SerializationInfo info, StreamingContext 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] @@ -35,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/Bytecode/UnableToLoadProxyFactoryFactoryException.cs b/src/NHibernate/Bytecode/UnableToLoadProxyFactoryFactoryException.cs index bf0a1e49a46..10f81028196 100644 --- a/src/NHibernate/Bytecode/UnableToLoadProxyFactoryFactoryException.cs +++ b/src/NHibernate/Bytecode/UnableToLoadProxyFactoryFactoryException.cs @@ -26,6 +26,7 @@ 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] @@ -34,6 +35,7 @@ public override void GetObjectData(SerializationInfo info, StreamingContext cont 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/DuplicateMappingException.cs b/src/NHibernate/DuplicateMappingException.cs index 522c38c4c84..4fe33607324 100644 --- a/src/NHibernate/DuplicateMappingException.cs +++ b/src/NHibernate/DuplicateMappingException.cs @@ -58,6 +58,7 @@ 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] @@ -67,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/AggregateHibernateException.cs b/src/NHibernate/Exceptions/AggregateHibernateException.cs index 1200f00e4ab..8424bd65845 100644 --- a/src/NHibernate/Exceptions/AggregateHibernateException.cs +++ b/src/NHibernate/Exceptions/AggregateHibernateException.cs @@ -88,6 +88,7 @@ protected AggregateHibernateException(SerializationInfo info, StreamingContext c 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] @@ -96,6 +97,7 @@ public override void GetObjectData(SerializationInfo info, StreamingContext cont 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 dee027ac25a..0485bcc2d03 100644 --- a/src/NHibernate/Exceptions/ConstraintViolationException.cs +++ b/src/NHibernate/Exceptions/ConstraintViolationException.cs @@ -36,6 +36,7 @@ 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] @@ -44,6 +45,7 @@ public override void GetObjectData(SerializationInfo info, StreamingContext cont 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/InstantiationException.cs b/src/NHibernate/InstantiationException.cs index 1383ce1bc3e..df7a57c41cd 100644 --- a/src/NHibernate/InstantiationException.cs +++ b/src/NHibernate/InstantiationException.cs @@ -81,6 +81,7 @@ protected InstantiationException(SerializationInfo info, StreamingContext contex 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. @@ -100,6 +101,7 @@ public override void GetObjectData(SerializationInfo info, StreamingContext cont 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 0d888ec949e..8eb770cf2e5 100644 --- a/src/NHibernate/InvalidProxyTypeException.cs +++ b/src/NHibernate/InvalidProxyTypeException.cs @@ -43,6 +43,7 @@ public InvalidProxyTypeException(SerializationInfo info, StreamingContext contex 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] @@ -51,6 +52,7 @@ public override void GetObjectData(SerializationInfo info, StreamingContext cont 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 4c3f1969568..0bbbb3e838b 100644 --- a/src/NHibernate/LazyInitializationException.cs +++ b/src/NHibernate/LazyInitializationException.cs @@ -91,6 +91,7 @@ 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] @@ -100,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/NonUniqueObjectException.cs b/src/NHibernate/NonUniqueObjectException.cs index a0b9917b3d8..ba695cb8bb0 100644 --- a/src/NHibernate/NonUniqueObjectException.cs +++ b/src/NHibernate/NonUniqueObjectException.cs @@ -69,6 +69,7 @@ protected NonUniqueObjectException(SerializationInfo info, StreamingContext cont 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. @@ -89,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/ObjectNotFoundByUniqueKeyException.cs b/src/NHibernate/ObjectNotFoundByUniqueKeyException.cs index 8ccbba3a2ea..9ffb72c47f3 100644 --- a/src/NHibernate/ObjectNotFoundByUniqueKeyException.cs +++ b/src/NHibernate/ObjectNotFoundByUniqueKeyException.cs @@ -44,6 +44,7 @@ protected ObjectNotFoundByUniqueKeyException(SerializationInfo info, StreamingCo 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] @@ -53,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/PropertyAccessException.cs b/src/NHibernate/PropertyAccessException.cs index a7413b3dc23..66f9608698d 100644 --- a/src/NHibernate/PropertyAccessException.cs +++ b/src/NHibernate/PropertyAccessException.cs @@ -90,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. @@ -111,6 +112,7 @@ public override void GetObjectData(SerializationInfo info, StreamingContext cont info.AddValue("propertyName", propertyName); info.AddValue("wasSetter", wasSetter); } +#pragma warning restore CS0809 #endregion } diff --git a/src/NHibernate/PropertyNotFoundException.cs b/src/NHibernate/PropertyNotFoundException.cs index 756a0bad6ab..3a13d5eb256 100644 --- a/src/NHibernate/PropertyNotFoundException.cs +++ b/src/NHibernate/PropertyNotFoundException.cs @@ -82,6 +82,7 @@ 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] @@ -92,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 006c4cd12a6..fe62bd72b83 100644 --- a/src/NHibernate/PropertyValueException.cs +++ b/src/NHibernate/PropertyValueException.cs @@ -72,6 +72,7 @@ protected PropertyValueException(SerializationInfo info, StreamingContext contex propertyName = info.GetString("propertyName"); } +#pragma warning disable CS0809 /// /// Sets the serialization info for after /// getting the info from the base Exception. @@ -92,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 1c0948f0112..e26275d950e 100644 --- a/src/NHibernate/QueryException.cs +++ b/src/NHibernate/QueryException.cs @@ -119,6 +119,7 @@ protected QueryException(SerializationInfo info, StreamingContext context) : bas queryString = info.GetString("queryString"); } +#pragma warning disable CS0809 /// /// Sets the serialization info for after /// getting the info from the base Exception. @@ -138,6 +139,7 @@ public override void GetObjectData(SerializationInfo info, StreamingContext cont base.GetObjectData(info, context); info.AddValue("queryString", queryString, typeof(String)); } +#pragma warning restore CS0809 #endregion } diff --git a/src/NHibernate/SchemaValidationException.cs b/src/NHibernate/SchemaValidationException.cs index 43ed1ca321f..fdb2d0bc1b6 100644 --- a/src/NHibernate/SchemaValidationException.cs +++ b/src/NHibernate/SchemaValidationException.cs @@ -24,6 +24,7 @@ protected SchemaValidationException(SerializationInfo info, StreamingContext con (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] @@ -32,5 +33,6 @@ public override void GetObjectData(SerializationInfo info, StreamingContext cont base.GetObjectData(info, context); info.AddValue("ValidationErrors", ValidationErrors); } +#pragma warning restore CS0809 } } diff --git a/src/NHibernate/StaleObjectStateException.cs b/src/NHibernate/StaleObjectStateException.cs index 3e2ae54be35..a7e1d8f10cf 100644 --- a/src/NHibernate/StaleObjectStateException.cs +++ b/src/NHibernate/StaleObjectStateException.cs @@ -88,6 +88,7 @@ protected StaleObjectStateException(SerializationInfo info, StreamingContext con identifier = info.GetValue("identifier", typeof(object)); } +#pragma warning disable CS0809 /// /// Sets the serialization info for after /// getting the info from the base Exception. @@ -108,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/UnresolvableObjectException.cs b/src/NHibernate/UnresolvableObjectException.cs index 35840344cb0..75be1da8251 100644 --- a/src/NHibernate/UnresolvableObjectException.cs +++ b/src/NHibernate/UnresolvableObjectException.cs @@ -92,6 +92,7 @@ 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] @@ -102,6 +103,7 @@ public override void GetObjectData(SerializationInfo info, StreamingContext cont info.AddValue("clazz", clazz); info.AddValue("entityName", entityName); } +#pragma warning restore CS0809 // Since v5.6 [Obsolete("This API supports obsolete formatter-based serialization and will be removed in a future version")] diff --git a/src/NHibernate/WrongClassException.cs b/src/NHibernate/WrongClassException.cs index 9040d822eaa..3018636d031 100644 --- a/src/NHibernate/WrongClassException.cs +++ b/src/NHibernate/WrongClassException.cs @@ -77,6 +77,7 @@ protected WrongClassException(SerializationInfo info, StreamingContext context) 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 +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 } From 8bef6af351731f45e74e0ad4941dad3222fc644a Mon Sep 17 00:00:00 2001 From: Alex Zaytsev Date: Fri, 1 Mar 2024 11:51:32 +1000 Subject: [PATCH 3/9] Fix dotnet version for pipeline --- .github/workflows/GenerateAsyncCode.yml | 2 +- .github/workflows/NetCoreTests.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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: | From 57aedefed63a9e3ab5247f20edc2413055a7c19f Mon Sep 17 00:00:00 2001 From: Alex Zaytsev Date: Fri, 1 Mar 2024 12:07:49 +1000 Subject: [PATCH 4/9] Set LangVersion to 12.0 --- build-common/NHibernate.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-common/NHibernate.props b/build-common/NHibernate.props index 8cc1c463f2f..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) From 2092aa1d9681c5dbb9b7be50596fca212d9e0240 Mon Sep 17 00:00:00 2001 From: Alex Zaytsev Date: Fri, 1 Mar 2024 12:13:36 +1000 Subject: [PATCH 5/9] Fix build --- src/NHibernate.Test/NHibernate.Test.csproj | 2 +- src/NHibernate/Tuple/Entity/PocoEntityInstantiator.cs | 2 +- src/NHibernate/Tuple/PocoInstantiator.cs | 4 +++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/NHibernate.Test/NHibernate.Test.csproj b/src/NHibernate.Test/NHibernate.Test.csproj index 6e5a4769304..75077b990a4 100644 --- a/src/NHibernate.Test/NHibernate.Test.csproj +++ b/src/NHibernate.Test/NHibernate.Test.csproj @@ -4,7 +4,7 @@ The Unit Tests for NHibernate. $(NhAppTargetFrameworks) true - $(NoWarn);3001;3002;3003;3005;SYSLIB0003;SYSLIB0012 + $(NoWarn);3001;3002;3003;3005;8981;SYSLIB0003;SYSLIB0012 true 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(); } From 66569a3661bb7d467e11b1e04aae746ae399f584 Mon Sep 17 00:00:00 2001 From: Alex Zaytsev Date: Sun, 3 Mar 2024 23:47:21 +0000 Subject: [PATCH 6/9] update AsyncGenerator to 0.22.0 --- .config/dotnet-tools.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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" ] From c80f2e4cb9d75618cf2c6dad4ff48dd28707307b Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sun, 3 Mar 2024 23:49:37 +0000 Subject: [PATCH 7/9] Generate async files --- .../Async/CacheTest/SerializationFixture.cs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) 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)); } } From 67cffe1192fc6e79ada2ad7607ad11be333f9c99 Mon Sep 17 00:00:00 2001 From: Alex Zaytsev Date: Sun, 3 Mar 2024 23:52:24 +0000 Subject: [PATCH 8/9] EnableUnsafeBinaryFormatterSerialization --- src/NHibernate.Test/NHibernate.Test.csproj | 1 + 1 file changed, 1 insertion(+) diff --git a/src/NHibernate.Test/NHibernate.Test.csproj b/src/NHibernate.Test/NHibernate.Test.csproj index 75077b990a4..ee64e604146 100644 --- a/src/NHibernate.Test/NHibernate.Test.csproj +++ b/src/NHibernate.Test/NHibernate.Test.csproj @@ -6,6 +6,7 @@ true $(NoWarn);3001;3002;3003;3005;8981;SYSLIB0003;SYSLIB0012 true + true Exe From d559c604357c05f452ba63d812cc5221d970386e Mon Sep 17 00:00:00 2001 From: Alex Zaytsev Date: Mon, 4 Mar 2024 10:05:02 +1000 Subject: [PATCH 9/9] Add shim to fix compilation --- .../CacheTest/TextReaderExtensions.cs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 src/NHibernate.Test/CacheTest/TextReaderExtensions.cs 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