While, this is certainly a problem, it SHOULD not be the issue already
reported, because those reports were against log4Net running on the 2.0
CLR instead of the 4.0 CLR.

I have done some research this morning, and have found a couple of
articles suggesting "fixes", but I do not yet understand the
ramifications.  This is all to do with a new code security model created
in 4.0 and it is going to take time to understand.

If anyone reading this is a 4.0 code security model guru, then please
look at
http://connect.microsoft.com/VisualStudio/feedback/details/464751/inheri
tance-security-rules-violated-while-overriding-member and throw out an
opinion.

The other solution seems to involve marking the calling code, but I have
not figured it all out as yet.

----------------------------------------------------------------------
Roy Chastain




-----Original Message-----
From: Stefan Bodewig [mailto:bode...@apache.org] 
Sent: Thursday, August 18, 2011 23:41
To: log4net-dev@logging.apache.org
Subject: ADO.NET Appender and FX 4.0

Hi,

Roy said in some thread people had reported problems with the ADO.NET
appender when running on .NET 4.0.

I managed to get to the point where NAnt at least tries to run the unit
tests on 4.0 and this is what I see:

Unhandled Exception: System.TypeLoadException: Inheritance security
rules violated while overriding member:
'log4net.Core.LoggingEvent.GetObjectData(System.Runtime.Serialization.Se
rializationInfo, System.Runtime.Serialization.StreamingContext)'.
Security accessibility of the overriding method must match the security
accessibility of the method being overriden.
   at log4net.Appender.BufferingAppenderSkeleton.Flush(Boolean
flushLossyBuffer)

   at log4net.Appender.BufferingAppenderSkeleton.OnClose() in
c:\OSS\log4net\src\Appender\BufferingAppenderSkeleton.cs:line 411
   at log4net.Appender.AdoNetAppender.OnClose() in
c:\OSS\log4net\src\Appender\AdoNetAppender.cs:line 433
   at log4net.Appender.AppenderSkeleton.Close() in
c:\OSS\log4net\src\Appender\AppenderSkeleton.cs:line 243
   at log4net.Appender.AppenderSkeleton.Finalize() in
c:\OSS\log4net\src\Appender\AppenderSkeleton.cs:line 83

which may or may not be related.

I do not see this when I tell NAnt to use the .NET FX 2.0 (via Nant
-t:net-2.0) - I "only" get the ten unit test failures I already raised
in JIRA.

Stefan

Reply via email to