Author: bodewig
Date: Sun Mar 29 10:11:42 2015
New Revision: 1669885

URL: http://svn.apache.org/r1669885
Log:
LOG4NET-455 make code compile on .NET 2.0

Modified:
    logging/log4net/trunk/src/log4net/Util/LogicalThreadContextProperties.cs
    logging/log4net/trunk/src/log4net/Util/LogicalThreadContextStack.cs

Modified: 
logging/log4net/trunk/src/log4net/Util/LogicalThreadContextProperties.cs
URL: 
http://svn.apache.org/viewvc/logging/log4net/trunk/src/log4net/Util/LogicalThreadContextProperties.cs?rev=1669885&r1=1669884&r2=1669885&view=diff
==============================================================================
--- logging/log4net/trunk/src/log4net/Util/LogicalThreadContextProperties.cs 
(original)
+++ logging/log4net/trunk/src/log4net/Util/LogicalThreadContextProperties.cs 
Sun Mar 29 10:11:42 2015
@@ -100,10 +100,10 @@ namespace log4net.Util
                        set 
                        {
                                // Force the dictionary to be created
-                               var props = GetProperties(true);
+                               PropertiesDictionary props = 
GetProperties(true);
                                // Reason for cloning the dictionary below: 
object instances set on the CallContext
                                // need to be immutable to correctly flow 
through async/await
-                               var immutableProps = new 
PropertiesDictionary(props);
+                               PropertiesDictionary immutableProps = new 
PropertiesDictionary(props);
                                immutableProps[key] = value;
                                SetCallContextData(immutableProps);
                        }
@@ -127,7 +127,7 @@ namespace log4net.Util
                        PropertiesDictionary dictionary = GetProperties(false);
                        if (dictionary != null)
                        {
-                               var immutableProps = new 
PropertiesDictionary(dictionary);
+                               PropertiesDictionary immutableProps = new 
PropertiesDictionary(dictionary);
                                immutableProps.Remove(key);
                                SetCallContextData(immutableProps);
                        }
@@ -146,7 +146,7 @@ namespace log4net.Util
                        PropertiesDictionary dictionary = GetProperties(false);
                        if (dictionary != null)
                        {
-                               var immutableProps = new PropertiesDictionary();
+                               PropertiesDictionary immutableProps = new 
PropertiesDictionary();
                                SetCallContextData(immutableProps);
                        }
                }

Modified: logging/log4net/trunk/src/log4net/Util/LogicalThreadContextStack.cs
URL: 
http://svn.apache.org/viewvc/logging/log4net/trunk/src/log4net/Util/LogicalThreadContextStack.cs?rev=1669885&r1=1669884&r2=1669885&view=diff
==============================================================================
--- logging/log4net/trunk/src/log4net/Util/LogicalThreadContextStack.cs 
(original)
+++ logging/log4net/trunk/src/log4net/Util/LogicalThreadContextStack.cs Sun Mar 
29 10:11:42 2015
@@ -144,8 +144,9 @@ namespace log4net.Util
                        {
                                result = ((StackFrame)(stack.Pop())).Message;
                        }
-                       m_registerNew(m_propertyKey,
-                               new LogicalThreadContextStack(m_propertyKey, 
m_registerNew) { m_stack = stack });
+                       LogicalThreadContextStack ltcs = new 
LogicalThreadContextStack(m_propertyKey, m_registerNew);
+                       ltcs.m_stack = stack;
+                       m_registerNew(m_propertyKey, ltcs);
                        return result;
                }
 
@@ -178,7 +179,8 @@ namespace log4net.Util
                        Stack stack = new Stack(new Stack(m_stack));
                        stack.Push(new StackFrame(message, (stack.Count > 0) ? 
(StackFrame)stack.Peek() : null));
 
-                       var contextStack = new 
LogicalThreadContextStack(m_propertyKey, m_registerNew) { m_stack = stack };
+                       LogicalThreadContextStack contextStack = new 
LogicalThreadContextStack(m_propertyKey, m_registerNew);
+                       contextStack.m_stack = stack;
                        m_registerNew(m_propertyKey, contextStack);
                        return new AutoPopStackFrame(contextStack, stack.Count 
- 1);
                }
@@ -399,8 +401,10 @@ namespace log4net.Util
                                        {
                                                stack.Pop();
                                        }
+                                       LogicalThreadContextStack ltcs = new 
LogicalThreadContextStack(m_logicalThreadContextStack.m_propertyKey, 
m_logicalThreadContextStack.m_registerNew);
+                                       ltcs.m_stack = stack;
                                        
m_logicalThreadContextStack.m_registerNew(m_logicalThreadContextStack.m_propertyKey,
-                                               new 
LogicalThreadContextStack(m_logicalThreadContextStack.m_propertyKey, 
m_logicalThreadContextStack.m_registerNew) { m_stack = stack });
+                                               ltcs);
                                }
                        }
 


Reply via email to