Return-Path: X-Original-To: apmail-logging-log4net-dev-archive@www.apache.org Delivered-To: apmail-logging-log4net-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 698BD17464 for ; Mon, 30 Mar 2015 06:03:15 +0000 (UTC) Received: (qmail 47710 invoked by uid 500); 30 Mar 2015 06:02:53 -0000 Delivered-To: apmail-logging-log4net-dev-archive@logging.apache.org Received: (qmail 47676 invoked by uid 500); 30 Mar 2015 06:02:53 -0000 Mailing-List: contact log4net-dev-help@logging.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: "Log4NET Dev" List-Id: Delivered-To: mailing list log4net-dev@logging.apache.org Received: (qmail 47656 invoked by uid 99); 30 Mar 2015 06:02:53 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 30 Mar 2015 06:02:53 +0000 Date: Mon, 30 Mar 2015 06:02:53 +0000 (UTC) From: "Stefan Bodewig (JIRA)" To: log4net-dev@logging.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (LOG4NET-437) LogicalThreadContext data does not flow properly using Async and Await MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/LOG4NET-437?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14386242#comment-14386242 ] Stefan Bodewig commented on LOG4NET-437: ---------------------------------------- Sorry, when I opened LOG4NET-456 I completely forgot about this one. Could you please verify the fix applied for LOG4NET-456 works for your application as well? > LogicalThreadContext data does not flow properly using Async and Await > ---------------------------------------------------------------------- > > Key: LOG4NET-437 > URL: https://issues.apache.org/jira/browse/LOG4NET-437 > Project: Log4net > Issue Type: Bug > Components: Core > Affects Versions: 1.2.9, 1.2.10, 1.2.11, 1.2.12, 1.2.13 > Environment: Windows 7, .NET 4.5 > Reporter: Mike Barry > Attachments: LogicalThreadContext.diff, Program.cs, ThreadContextStacks.diff > > > LogicalThreadContext doesn't work properly when using Async and Await. The current NDC call stack gets corrupted because the logical data context is not immutable. (See: http://blog.stephencleary.com/2013/04/implicit-async-context-asynclocal.html for the gory details). I've attached a Program.cs that demonstrates the issue. You will see with an unpatched log4net the thread context is corrupted compared to the proper implementation in MyStack and the console logger. An entry like: > LOG4NET Main 1 A 2 A: > LOG4NET Main 1 A 2 A: > is invalid and should not be possible in a properly working thread context. > I've attached a VERY naive patch that corrects the issue. -- This message was sent by Atlassian JIRA (v6.3.4#6332)