This is an automated email from the ASF dual-hosted git repository. FreeAndNil pushed a commit to branch Feature/307-cls-compliant in repository https://gitbox.apache.org/repos/asf/logging-log4net.git
commit c9af89e5fe3e66f619ac4a1dcb130e578cc79565 Author: Jan Friedrich <[email protected]> AuthorDate: Sun Aug 16 21:25:38 2026 +0200 mark log4net.Ext.Mail as CLS compliant (#307) --- src/Directory.Build.props | 7 +++++++ src/log4net.Ext.Mail/Appender/SmtpAppender.cs | 7 +++++++ src/log4net/AssemblyInfo.cs | 1 - 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 8c4ab3ac..126deb49 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -31,4 +31,11 @@ <ItemGroup> <GlobalAnalyzerConfigFiles Include="$(MSBuildThisFileDirectory)log4net.globalconfig" /> </ItemGroup> + <ItemGroup> + <!-- Emitted into every project that generates its assembly info, which is the shipping + libraries but not the test projects, as those set GenerateAssemblyInfo to false. --> + <AssemblyAttribute Include="System.CLSCompliantAttribute"> + <_Parameter1>true</_Parameter1> + </AssemblyAttribute> + </ItemGroup> </Project> \ No newline at end of file diff --git a/src/log4net.Ext.Mail/Appender/SmtpAppender.cs b/src/log4net.Ext.Mail/Appender/SmtpAppender.cs index 53f07aa4..54ce6a91 100644 --- a/src/log4net.Ext.Mail/Appender/SmtpAppender.cs +++ b/src/log4net.Ext.Mail/Appender/SmtpAppender.cs @@ -356,6 +356,13 @@ protected virtual void SendEmail(string messageBody) /// </summary> /// <param name="messageBody">the body text to include in the mail</param> /// <returns>the message to send</returns> + /// <remarks> + /// <para> + /// Not CLS compliant, because <see cref="MimeMessage"/> comes from MimeKit, which does not + /// declare itself CLS compliant. + /// </para> + /// </remarks> + [CLSCompliant(false)] protected virtual MimeMessage CreateMessage(string messageBody) { MimeMessage message = new(); diff --git a/src/log4net/AssemblyInfo.cs b/src/log4net/AssemblyInfo.cs index 58f9ab7e..8c87d7d9 100644 --- a/src/log4net/AssemblyInfo.cs +++ b/src/log4net/AssemblyInfo.cs @@ -19,7 +19,6 @@ // log4net makes use of static methods which cannot be made com visible [assembly: System.Runtime.InteropServices.ComVisible(false)] -[assembly: System.CLSCompliant(true)] // If log4net is strongly named it still allows partially trusted callers [assembly: System.Security.AllowPartiallyTrustedCallers]
