jberg7 opened a new issue, #245:
URL: https://github.com/apache/logging-log4net/issues/245

   It looks like 
https://github.com/apache/logging-log4net/commit/b5f6ea2df90372cbe3bc679e6fffa07b984fdb6e
 broke NDC.Inherit(). By way of example:
   
   ```c#
   var context = NDC.CloneStack();
   NDC.Inherit(context);
   ```
   
   Gives this error:
   ```
      System.InvalidCastException : Unable to cast object of type 
'System.Object[]' to type 'StackFrame[]'.
     Stack Trace:
        at log4net.Util.ThreadContextStack.set_InternalStack(Stack value) in 
/home/alle/git/apache/logging-log4net/src/log4net/Util/ThreadContextStack.cs:line
 191
      at log4net.NDC.Inherit(Stack stack) in 
/home/alle/git/apache/logging-log4net/src/log4net/NDC.cs:line 160
   ```
   
   I understand that the use of NDC has been deprecated for some time, but from 
looking at the code it seems the intent of log4net 3 has been to maintain 
backwards compatibility, so I think this behavior is a bug.
   
   (On a related note, is there an appropriate replacement for the above, other 
than writing my own custom copy mechanism to 
`ThreadContext.Stacks["NDC"].Pop()` into some temporary array, and then later 
on `.Push()` back onto the stack?)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to