You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by fr...@apache.org on 2024/09/05 23:00:21 UTC
(logging-log4net) branch Feature/173-Dropping-legacy-serialization-support created (now 987c927d)
This is an automated email from the ASF dual-hosted git repository.
freeandnil pushed a change to branch Feature/173-Dropping-legacy-serialization-support
in repository https://gitbox.apache.org/repos/asf/logging-log4net.git
at 987c927d Dropping support for legacy serialization
This branch includes the following new commits:
new 987c927d Dropping support for legacy serialization
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
(logging-log4net) 01/01: Dropping support for legacy serialization
Posted by fr...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
freeandnil pushed a commit to branch Feature/173-Dropping-legacy-serialization-support
in repository https://gitbox.apache.org/repos/asf/logging-log4net.git
commit 987c927da3376851a5179c99ba3a738fc683beaa
Author: Jan Friedrich <fr...@apache.org>
AuthorDate: Fri Sep 6 00:59:51 2024 +0200
Dropping support for legacy serialization
---
src/log4net/Appender/FileAppender.cs | 2 +-
src/log4net/Config/AliasRepositoryAttribute.cs | 2 +-
src/log4net/Config/PluginAttribute.cs | 2 +-
src/log4net/Config/RepositoryAttribute.cs | 2 +-
src/log4net/Config/SecurityContextProviderAttribute.cs | 2 +-
src/log4net/Config/XmlConfiguratorAttribute.cs | 2 +-
src/log4net/Core/Level.cs | 4 ++--
src/log4net/Core/LocationInfo.cs | 4 ++--
src/log4net/Core/LogException.cs | 2 +-
src/log4net/Core/LoggingEvent.cs | 4 ++--
src/log4net/Core/MethodItem.cs | 2 +-
src/log4net/Core/Serializable.cs | 17 +++++++++++++++++
src/log4net/Core/StackFrameItem.cs | 2 +-
src/log4net/Util/EmptyCollection.cs | 2 +-
src/log4net/Util/EmptyDictionary.cs | 2 +-
src/log4net/Util/PropertiesDictionary.cs | 4 ++--
src/log4net/Util/ReadOnlyPropertiesDictionary.cs | 4 ++--
.../TypeConverters/ConversionNotSupportedException.cs | 2 +-
18 files changed, 39 insertions(+), 22 deletions(-)
diff --git a/src/log4net/Appender/FileAppender.cs b/src/log4net/Appender/FileAppender.cs
index 15131146..5be9ab8e 100644
--- a/src/log4net/Appender/FileAppender.cs
+++ b/src/log4net/Appender/FileAppender.cs
@@ -86,7 +86,7 @@ namespace log4net.Appender
/// </summary>
private sealed class LockingStream : Stream, IDisposable
{
- [Serializable]
+ [Log4NetSerializable]
public sealed class LockStateException : LogException
{
public LockStateException(string message)
diff --git a/src/log4net/Config/AliasRepositoryAttribute.cs b/src/log4net/Config/AliasRepositoryAttribute.cs
index 39373331..2d7002d0 100644
--- a/src/log4net/Config/AliasRepositoryAttribute.cs
+++ b/src/log4net/Config/AliasRepositoryAttribute.cs
@@ -41,7 +41,7 @@ namespace log4net.Config
/// <author>Nicko Cadell</author>
/// <author>Gert Driesen</author>
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
- [Serializable]
+ [Log4NetSerializable]
public sealed class AliasRepositoryAttribute : Attribute
{
/// <summary>
diff --git a/src/log4net/Config/PluginAttribute.cs b/src/log4net/Config/PluginAttribute.cs
index 9ef26e61..c9110b24 100644
--- a/src/log4net/Config/PluginAttribute.cs
+++ b/src/log4net/Config/PluginAttribute.cs
@@ -39,7 +39,7 @@ namespace log4net.Config
/// <author>Nicko Cadell</author>
/// <author>Gert Driesen</author>
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
- [Serializable]
+ [Log4NetSerializable]
public sealed class PluginAttribute : Attribute, IPluginFactory
{
/// <summary>
diff --git a/src/log4net/Config/RepositoryAttribute.cs b/src/log4net/Config/RepositoryAttribute.cs
index 59514517..ccf4efb7 100644
--- a/src/log4net/Config/RepositoryAttribute.cs
+++ b/src/log4net/Config/RepositoryAttribute.cs
@@ -42,7 +42,7 @@ namespace log4net.Config
/// <author>Nicko Cadell</author>
/// <author>Gert Driesen</author>
[AttributeUsage(AttributeTargets.Assembly)]
- [Serializable]
+ [Log4NetSerializable]
public sealed class RepositoryAttribute : Attribute
{
/// <summary>
diff --git a/src/log4net/Config/SecurityContextProviderAttribute.cs b/src/log4net/Config/SecurityContextProviderAttribute.cs
index e82e858e..e8edeee2 100644
--- a/src/log4net/Config/SecurityContextProviderAttribute.cs
+++ b/src/log4net/Config/SecurityContextProviderAttribute.cs
@@ -42,7 +42,7 @@ namespace log4net.Config
/// </remarks>
/// <author>Nicko Cadell</author>
[AttributeUsage(AttributeTargets.Assembly)]
- [Serializable]
+ [Log4NetSerializable]
public sealed class SecurityContextProviderAttribute : ConfiguratorAttribute
{
/// <summary>
diff --git a/src/log4net/Config/XmlConfiguratorAttribute.cs b/src/log4net/Config/XmlConfiguratorAttribute.cs
index aee8389c..24411cbd 100644
--- a/src/log4net/Config/XmlConfiguratorAttribute.cs
+++ b/src/log4net/Config/XmlConfiguratorAttribute.cs
@@ -76,7 +76,7 @@ namespace log4net.Config
/// <author>Nicko Cadell</author>
/// <author>Gert Driesen</author>
[AttributeUsage(AttributeTargets.Assembly)]
- [Serializable]
+ [Log4NetSerializable]
public sealed class XmlConfiguratorAttribute : ConfiguratorAttribute
{
/// <summary>
diff --git a/src/log4net/Core/Level.cs b/src/log4net/Core/Level.cs
index e15078b6..3027fb58 100644
--- a/src/log4net/Core/Level.cs
+++ b/src/log4net/Core/Level.cs
@@ -82,8 +82,8 @@ namespace log4net.Core;
/// </remarks>
/// <author>Nicko Cadell</author>
/// <author>Gert Driesen</author>
-[Serializable]
-public class Level : IComparable, ISerializable, IEquatable<Level>, IComparable<Level>
+[Log4NetSerializable]
+public class Level : IComparable, ILog4NetSerializable, IEquatable<Level>, IComparable<Level>
{
/// <summary>
/// Constructor
diff --git a/src/log4net/Core/LocationInfo.cs b/src/log4net/Core/LocationInfo.cs
index 2ce29ae0..3e1c3ef0 100644
--- a/src/log4net/Core/LocationInfo.cs
+++ b/src/log4net/Core/LocationInfo.cs
@@ -57,8 +57,8 @@ namespace log4net.Core
/// </remarks>
/// <author>Nicko Cadell</author>
/// <author>Gert Driesen</author>
- [Serializable]
- public class LocationInfo : ISerializable
+ [Log4NetSerializable]
+ public class LocationInfo : ILog4NetSerializable
{
/// <summary>
/// Constructor
diff --git a/src/log4net/Core/LogException.cs b/src/log4net/Core/LogException.cs
index 33a604d3..762eb384 100644
--- a/src/log4net/Core/LogException.cs
+++ b/src/log4net/Core/LogException.cs
@@ -34,7 +34,7 @@ namespace log4net.Core
/// </remarks>
/// <author>Nicko Cadell</author>
/// <author>Gert Driesen</author>
- [Serializable]
+ [Log4NetSerializable]
public class LogException : ApplicationException
{
/// <summary>
diff --git a/src/log4net/Core/LoggingEvent.cs b/src/log4net/Core/LoggingEvent.cs
index 48d2e25f..8cfadf51 100644
--- a/src/log4net/Core/LoggingEvent.cs
+++ b/src/log4net/Core/LoggingEvent.cs
@@ -164,8 +164,8 @@ namespace log4net.Core
/// <author>Gert Driesen</author>
/// <author>Douglas de la Torre</author>
/// <author>Daniel Cazzulino</author>
- [Serializable]
- public class LoggingEvent : ISerializable
+ [Log4NetSerializable]
+ public class LoggingEvent : ILog4NetSerializable
{
private static readonly Type declaringType = typeof(LoggingEvent);
diff --git a/src/log4net/Core/MethodItem.cs b/src/log4net/Core/MethodItem.cs
index 5e8314bb..5c8d02c6 100644
--- a/src/log4net/Core/MethodItem.cs
+++ b/src/log4net/Core/MethodItem.cs
@@ -28,7 +28,7 @@ namespace log4net.Core
/// as that would require that the containing assembly is loaded.
/// </summary>
///
- [Serializable]
+ [Log4NetSerializable]
public class MethodItem
{
/// <summary>
diff --git a/src/log4net/Core/Serializable.cs b/src/log4net/Core/Serializable.cs
new file mode 100644
index 00000000..157bfd3e
--- /dev/null
+++ b/src/log4net/Core/Serializable.cs
@@ -0,0 +1,17 @@
+/*
+#if NET462_OR_GREATER
+global using Log4NetSerializableAttribute = System.SerializableAttribute;
+global using ILog4NetSerializable = System.Runtime.Serialization.ISerializable;
+#else*/
+global using Log4NetSerializableAttribute = log4net.Core.EmptyAttribute;
+global using ILog4NetSerializable = log4net.Core.IEmptyInterface;
+//#endif
+
+namespace log4net.Core;
+//#if !NET462_OR_GREATER
+internal interface IEmptyInterface
+{ }
+
+internal sealed class EmptyAttribute: System.Attribute
+{ }
+//#endif
\ No newline at end of file
diff --git a/src/log4net/Core/StackFrameItem.cs b/src/log4net/Core/StackFrameItem.cs
index a27d7037..6cf2f782 100644
--- a/src/log4net/Core/StackFrameItem.cs
+++ b/src/log4net/Core/StackFrameItem.cs
@@ -28,7 +28,7 @@ namespace log4net.Core
/// Provides stack frame information without actually referencing a System.Diagnostics.StackFrame
/// as that would require that the containing assembly is loaded.
/// </summary>
- [Serializable]
+ [Log4NetSerializable]
public class StackFrameItem
{
/// <summary>
diff --git a/src/log4net/Util/EmptyCollection.cs b/src/log4net/Util/EmptyCollection.cs
index 708370ca..30082648 100644
--- a/src/log4net/Util/EmptyCollection.cs
+++ b/src/log4net/Util/EmptyCollection.cs
@@ -33,7 +33,7 @@ namespace log4net.Util
/// </remarks>
/// <author>Nicko Cadell</author>
/// <author>Gert Driesen</author>
- [Serializable]
+ [Log4NetSerializable]
public sealed class EmptyCollection : ICollection
{
/// <summary>
diff --git a/src/log4net/Util/EmptyDictionary.cs b/src/log4net/Util/EmptyDictionary.cs
index 9ed11b08..fbee5305 100644
--- a/src/log4net/Util/EmptyDictionary.cs
+++ b/src/log4net/Util/EmptyDictionary.cs
@@ -33,7 +33,7 @@ namespace log4net.Util
/// </remarks>
/// <author>Nicko Cadell</author>
/// <author>Gert Driesen</author>
- [Serializable]
+ [Log4NetSerializable]
public sealed class EmptyDictionary : IDictionary
{
/// <summary>
diff --git a/src/log4net/Util/PropertiesDictionary.cs b/src/log4net/Util/PropertiesDictionary.cs
index 3f2c1064..b6682b66 100644
--- a/src/log4net/Util/PropertiesDictionary.cs
+++ b/src/log4net/Util/PropertiesDictionary.cs
@@ -36,8 +36,8 @@ namespace log4net.Util
/// </remarks>
/// <author>Nicko Cadell</author>
/// <author>Gert Driesen</author>
- [Serializable]
- public sealed class PropertiesDictionary : ReadOnlyPropertiesDictionary, ISerializable, IDictionary
+ [Log4NetSerializable]
+ public sealed class PropertiesDictionary : ReadOnlyPropertiesDictionary, ILog4NetSerializable, IDictionary
{
/// <summary>
/// Constructor
diff --git a/src/log4net/Util/ReadOnlyPropertiesDictionary.cs b/src/log4net/Util/ReadOnlyPropertiesDictionary.cs
index 2c347961..d2973218 100644
--- a/src/log4net/Util/ReadOnlyPropertiesDictionary.cs
+++ b/src/log4net/Util/ReadOnlyPropertiesDictionary.cs
@@ -40,8 +40,8 @@ namespace log4net.Util
/// </remarks>
/// <author>Nicko Cadell</author>
/// <author>Gert Driesen</author>
- [Serializable]
- public class ReadOnlyPropertiesDictionary : ISerializable, IDictionary, IDictionary<string, object?>
+ [Log4NetSerializable]
+ public class ReadOnlyPropertiesDictionary : ILog4NetSerializable, IDictionary, IDictionary<string, object?>
{
private const string ReadOnlyMessage = "This is a read-only dictionary and cannot be modified";
diff --git a/src/log4net/Util/TypeConverters/ConversionNotSupportedException.cs b/src/log4net/Util/TypeConverters/ConversionNotSupportedException.cs
index 6d33310e..6a351af3 100644
--- a/src/log4net/Util/TypeConverters/ConversionNotSupportedException.cs
+++ b/src/log4net/Util/TypeConverters/ConversionNotSupportedException.cs
@@ -34,7 +34,7 @@ namespace log4net.Util.TypeConverters
/// </remarks>
/// <author>Nicko Cadell</author>
/// <author>Gert Driesen</author>
- [Serializable]
+ [Log4NetSerializable]
public class ConversionNotSupportedException : ApplicationException
{
/// <summary>