[jira] [Comment Edited] (LOG4NET-398) SerializationException after setting a LogicalThreadContext property
[ https://issues.apache.org/jira/browse/LOG4NET-398?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15061999#comment-15061999 ] Dominik Psenner edited comment on LOG4NET-398 at 12/17/15 12:47 PM: Only classes derived from MarshalByRefObj are allowed to cross application domains. I'm still wondering why the ReadOnlyPropertiesDictionary crosses application domains. A class should not travel between application domains "by magic" as both application domains do not share the same memory and are virtually two processes executing in one process (this really sounds strange, yeah). Not even static readonly classes / properties are the same across two application domains.. So long as the root cause is not found I do not think that this patch should be applied. was (Author: nachbarslumpi): Only classes derived from MarshalByRefObj are allowed to cross application domains. I'm still wondering why the ReadOnlyPropertiesDictionary crosses application domains. A class should not travel between application domains "by magic" as both application domains do not share the same memory and are virtually two processes executing in one process (this really sounds strange, yeah). So long as the root cause is not found I do not think that this patch should be applied. > SerializationException after setting a LogicalThreadContext property > > > Key: LOG4NET-398 > URL: https://issues.apache.org/jira/browse/LOG4NET-398 > Project: Log4net > Issue Type: Task > Components: Core >Affects Versions: 1.2.12 > Environment: Visual Studio 2010 >Reporter: Thomas Meum >Priority: Minor > Labels: triaged > Attachments: log4net.zip > > > I have found that accessing Page.Request.Url after setting a > LogicalThreadContext property causes a SerializationException with the > following message: Type is not resolved for member > 'log4net.Util.PropertiesDictionary,log4net, Version=1.2.12.0, > Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a'. > I have been able to reproduce the problem on two different machines with the > following steps: > 1. Create a new ASP.NET Empty Web Application > 2. Add a reference to log4net.dll > 3. Add a new Web Form > 4. Add the following code to Page_Load: > log4net.LogicalThreadContext.Properties["Test"] = 1; > Uri url = Request.Url; > 5. Hit F5 -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Comment Edited] (LOG4NET-398) SerializationException after setting a LogicalThreadContext property
[ https://issues.apache.org/jira/browse/LOG4NET-398?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14658748#comment-14658748 ] JOHN Alexander ZABROSKI edited comment on LOG4NET-398 at 8/5/15 7:47 PM: - What .NET version number did this problem occur on? With the new RyuJIT optimization bugs becoming mainstream knowledge, I wonder if we need to add a custom field to JIRA to track which release of .NET the reporter is using. Further, are you running .NET 4.6 with Optimization enabled? was (Author: johnzabroski): What .NET version number did this problem occur on? With the new RyuJIT optimization bugs becoming mainstream knowledge, I wonder if we need to add a custom field to JIRA to track which release of .NET the reporter is using. SerializationException after setting a LogicalThreadContext property Key: LOG4NET-398 URL: https://issues.apache.org/jira/browse/LOG4NET-398 Project: Log4net Issue Type: Task Components: Core Affects Versions: 1.2.12 Environment: Visual Studio 2010 Reporter: Thomas Meum Priority: Minor Labels: triaged Attachments: log4net.zip I have found that accessing Page.Request.Url after setting a LogicalThreadContext property causes a SerializationException with the following message: Type is not resolved for member 'log4net.Util.PropertiesDictionary,log4net, Version=1.2.12.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a'. I have been able to reproduce the problem on two different machines with the following steps: 1. Create a new ASP.NET Empty Web Application 2. Add a reference to log4net.dll 3. Add a new Web Form 4. Add the following code to Page_Load: log4net.LogicalThreadContext.Properties[Test] = 1; Uri url = Request.Url; 5. Hit F5 -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Comment Edited] (LOG4NET-398) SerializationException after setting a LogicalThreadContext property
[ https://issues.apache.org/jira/browse/LOG4NET-398?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14599053#comment-14599053 ] Lars Nellemann Nielsen edited comment on LOG4NET-398 at 6/24/15 8:13 AM: - We have run into the same problem and can replicate the issue on sites running in IIS and a console application acting as a host for multiple other console applications, separated in appDomains. So both rely on separate appDomains. The issue goes away when not setting log4net.LogicalThreadContext.Properties LogicalThreadContext is implemented using System.Runtime.Remoting.Messaging.CallContext, and stores the data in log4net.Util.PropertiesDictionary which inherits log4net.Util.ReadOnlyPropertiesDictionary making [log4net.Util.ReadOnlyPropertiesDictionary|http://svn.apache.org/viewvc/logging/log4net/trunk/src/log4net/Util/ReadOnlyPropertiesDictionary.cs?view=markup] inherit [MarshalByRefObject|https://msdn.microsoft.com/en-us/library/system.marshalbyrefobject%28v=vs.110%29.aspx] fixes the issue. Its obvious that the properties dictionary cannot cross into the other appdomain, since inheriting MarshalByRefObject fixes it. I cannot see why installing log4net into the GAC fixes the problem as well, perhaps someone can shed some light on this? Can anyone confirm the fix? was (Author: nellemandela): We have run into the same problem and can replicate the issue on sites running in IIS and a console application acting as a host for multiple other console applications, separated in appDomains. So both rely on separate appDomains. The issue goes away when not setting log4net.LogicalThreadContext.Properties LogicalThreadContext is implemented using System.Runtime.Remoting.Messaging.CallContex, and stores the data in log4net.Util.PropertiesDictionary which inherits log4net.Util.ReadOnlyPropertiesDictionary making [log4net.Util.ReadOnlyPropertiesDictionary|http://svn.apache.org/viewvc/logging/log4net/trunk/src/log4net/Util/ReadOnlyPropertiesDictionary.cs?view=markup] inherit [MarshalByRefObject|https://msdn.microsoft.com/en-us/library/system.marshalbyrefobject%28v=vs.110%29.aspx] fixes the issue. Its obvious that the properties dictionary cannot cross into the other appdomain, since inheriting MarshalByRefObject fixes it. I cannot see why installing log4net into the GAC fixes the problem as well, perhaps someone can shed some light on this? Can anyone confirm the fix? SerializationException after setting a LogicalThreadContext property Key: LOG4NET-398 URL: https://issues.apache.org/jira/browse/LOG4NET-398 Project: Log4net Issue Type: Task Components: Core Affects Versions: 1.2.12 Environment: Visual Studio 2010 Reporter: Thomas Meum Priority: Minor Labels: triaged I have found that accessing Page.Request.Url after setting a LogicalThreadContext property causes a SerializationException with the following message: Type is not resolved for member 'log4net.Util.PropertiesDictionary,log4net, Version=1.2.12.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a'. I have been able to reproduce the problem on two different machines with the following steps: 1. Create a new ASP.NET Empty Web Application 2. Add a reference to log4net.dll 3. Add a new Web Form 4. Add the following code to Page_Load: log4net.LogicalThreadContext.Properties[Test] = 1; Uri url = Request.Url; 5. Hit F5 -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Comment Edited] (LOG4NET-398) SerializationException after setting a LogicalThreadContext property
[ https://issues.apache.org/jira/browse/LOG4NET-398?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14599324#comment-14599324 ] Lars Nellemann Nielsen edited comment on LOG4NET-398 at 6/24/15 12:38 PM: -- I'm not certain, frankly i'm a bit amazed that this is even an issue Ive attached a simple project, so you can reproduce the executing console application has no references to log4net, it doesn't even have any references to the other console applications as they are being loaded and executed with [AppDomain.ExecuteAssembly(String)|https://msdn.microsoft.com/en-us/library/sxx9f4c2%28v=vs.110%29.aspx] i.e only by their path and as you can see in the solution, no logging is being done Placing log4net.dll in the root of the executing console application is just the same as placing it in GAC was (Author: nellemandela): I'm not certain, frankly i'm a bit amazed that this is even an issue Ive attached a simple project, so you can reproduce the executing console application has no references to log4net, it doesn't even have any references to the other console applications as they are being loaded and executed with [AppDomain.ExecuteAssembly(String)|https://msdn.microsoft.com/en-us/library/sxx9f4c2%28v=vs.110%29.aspx] i.e only by their path Placing log4net.dll in the root of the executing console application is just the same as placing it in GAC SerializationException after setting a LogicalThreadContext property Key: LOG4NET-398 URL: https://issues.apache.org/jira/browse/LOG4NET-398 Project: Log4net Issue Type: Task Components: Core Affects Versions: 1.2.12 Environment: Visual Studio 2010 Reporter: Thomas Meum Priority: Minor Labels: triaged Attachments: log4net.zip I have found that accessing Page.Request.Url after setting a LogicalThreadContext property causes a SerializationException with the following message: Type is not resolved for member 'log4net.Util.PropertiesDictionary,log4net, Version=1.2.12.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a'. I have been able to reproduce the problem on two different machines with the following steps: 1. Create a new ASP.NET Empty Web Application 2. Add a reference to log4net.dll 3. Add a new Web Form 4. Add the following code to Page_Load: log4net.LogicalThreadContext.Properties[Test] = 1; Uri url = Request.Url; 5. Hit F5 -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Comment Edited] (LOG4NET-398) SerializationException after setting a LogicalThreadContext property
[ https://issues.apache.org/jira/browse/LOG4NET-398?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13801873#comment-13801873 ] Mike Podonyi edited comment on LOG4NET-398 at 10/22/13 2:51 PM: I am getting the same issue but NOT in an ASP context. I am having a service which i unit test. After adding: LogicalThreadContext.Properties\[SID]=this.Sid; I am getting the following issue running my unit test: -- Run test started -- An exception occurred while invoking executor 'executor://mstestadapter/v1': Type is not resolved for member 'log4net.Util.PropertiesDictionary,log4net, Version=1.2.12.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a'. == Run test finished: 0 run (0:00:07.559) == I am using Visual Studio 2012 Update 3 and .Net Framework 4.0. So i don't think it is a Visual Studio Issue. was (Author: rudimenter): I am getting the same issue but NOT in an ASP context. I am having a service which i unit test. After adding: LogicalThreadContext.Properties\[SID]=this.Sid; I am getting the following issue running my unit test: -- Run test started -- An exception occurred while invoking executor 'executor://mstestadapter/v1': Type is not resolved for member 'log4net.Util.PropertiesDictionary,log4net, Version=1.2.12.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a'. == Run test finished: 0 run (0:00:07.559) == Weird is, when i am running the Unit Test in the Debugger (F5) it works just fine. It only throws when i don't use the Debugger (Ctrl+F5). I am using Visual Studio 2012 Update 3 and .Net Framework 4.0. So i don't think it is a Visual Studio Issue. SerializationException after setting a LogicalThreadContext property Key: LOG4NET-398 URL: https://issues.apache.org/jira/browse/LOG4NET-398 Project: Log4net Issue Type: Bug Components: Core Affects Versions: 1.2.12 Environment: Visual Studio 2010 Reporter: Thomas Meum I have found that accessing Page.Request.Url after setting a LogicalThreadContext property causes a SerializationException with the following message: Type is not resolved for member 'log4net.Util.PropertiesDictionary,log4net, Version=1.2.12.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a'. I have been able to reproduce the problem on two different machines with the following steps: 1. Create a new ASP.NET Empty Web Application 2. Add a reference to log4net.dll 3. Add a new Web Form 4. Add the following code to Page_Load: log4net.LogicalThreadContext.Properties[Test] = 1; Uri url = Request.Url; 5. Hit F5 -- This message was sent by Atlassian JIRA (v6.1#6144)
[jira] [Comment Edited] (LOG4NET-398) SerializationException after setting a LogicalThreadContext property
[ https://issues.apache.org/jira/browse/LOG4NET-398?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13802014#comment-13802014 ] Dominik Psenner edited comment on LOG4NET-398 at 10/22/13 5:05 PM: --- Looks like some environments (i.e. Visual Studio 2010) are not smart enough to load referenced local assemblies. Placing these local assemblies in the right spot (nearby the executable), installing them into the GAC or maybe even working around this with the [AppDomain.AssemblyResolve|http://msdn.microsoft.com/en-us/library/system.appdomain.assemblyresolve.aspx] event should work around this issue. was (Author: nachbarslumpi): Looks like some environments (i.e. Visual Studio 2010) are not smart enough to load referenced local assemblies. Placing these local assemblies in the right spot (nearby the executable), installing them into the GAC or maybe working around this with the [AppDomain.AssemblyResolve|http://msdn.microsoft.com/en-us/library/system.appdomain.assemblyresolve.aspx] should solve the issue. SerializationException after setting a LogicalThreadContext property Key: LOG4NET-398 URL: https://issues.apache.org/jira/browse/LOG4NET-398 Project: Log4net Issue Type: Bug Components: Core Affects Versions: 1.2.12 Environment: Visual Studio 2010 Reporter: Thomas Meum I have found that accessing Page.Request.Url after setting a LogicalThreadContext property causes a SerializationException with the following message: Type is not resolved for member 'log4net.Util.PropertiesDictionary,log4net, Version=1.2.12.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a'. I have been able to reproduce the problem on two different machines with the following steps: 1. Create a new ASP.NET Empty Web Application 2. Add a reference to log4net.dll 3. Add a new Web Form 4. Add the following code to Page_Load: log4net.LogicalThreadContext.Properties[Test] = 1; Uri url = Request.Url; 5. Hit F5 -- This message was sent by Atlassian JIRA (v6.1#6144)
[jira] [Comment Edited] (LOG4NET-398) SerializationException after setting a LogicalThreadContext property
[ https://issues.apache.org/jira/browse/LOG4NET-398?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13802014#comment-13802014 ] Dominik Psenner edited comment on LOG4NET-398 at 10/22/13 5:04 PM: --- Looks like some environments (i.e. Visual Studio 2010) are not smart enough to load referenced local assemblies. Placing these local assemblies in the right spot (nearby the executable), installing them into the GAC or maybe working around this with the [AppDomain.AssemblyResolve|http://msdn.microsoft.com/en-us/library/system.appdomain.assemblyresolve.aspx] should solve the issue. was (Author: nachbarslumpi): Looks like some environments (i.e. Visual Studio 2010) are not smart enough to load referenced local assemblies. Placing these local assemblies in the right spot (nearby the executable), installing it into the GAC or maybe working around this with the [AppDomain.AssemblyResolve|http://msdn.microsoft.com/en-us/library/system.appdomain.assemblyresolve.aspx] should solve the issue. SerializationException after setting a LogicalThreadContext property Key: LOG4NET-398 URL: https://issues.apache.org/jira/browse/LOG4NET-398 Project: Log4net Issue Type: Bug Components: Core Affects Versions: 1.2.12 Environment: Visual Studio 2010 Reporter: Thomas Meum I have found that accessing Page.Request.Url after setting a LogicalThreadContext property causes a SerializationException with the following message: Type is not resolved for member 'log4net.Util.PropertiesDictionary,log4net, Version=1.2.12.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a'. I have been able to reproduce the problem on two different machines with the following steps: 1. Create a new ASP.NET Empty Web Application 2. Add a reference to log4net.dll 3. Add a new Web Form 4. Add the following code to Page_Load: log4net.LogicalThreadContext.Properties[Test] = 1; Uri url = Request.Url; 5. Hit F5 -- This message was sent by Atlassian JIRA (v6.1#6144)
[jira] [Comment Edited] (LOG4NET-398) SerializationException after setting a LogicalThreadContext property
[ https://issues.apache.org/jira/browse/LOG4NET-398?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13792483#comment-13792483 ] Dominik Psenner edited comment on LOG4NET-398 at 10/11/13 9:30 AM: --- The same project I used yesterday works with VS2012. Looks like they fixed something in VS2012. However, I don't see what we could do to resolve this issue and therefore I'm opting to resolve this issue as Invalid. In my opinion it makes no sense to add yet another documentation of a Visual Studio bug, since this issue is not limited to the usage of log4net in ASP.NET development using VS2010. Other assemblies are affected by this visual studio bug too. was (Author: nachbarslumpi): The same project I used yesterday works with VS2012. Looks like they fixed something in VS2012. However, I don't see what we could do to resolve this issue and therefore I'm opting to resolve this issue as Invalid. In my opinion it makes no sense to add yet another documentation of a Visual Studio bug, since this issue is not limited to the usage of log4net in ASP.NET development in VS2010. Other assemblies are affected by this visual studio bug too. SerializationException after setting a LogicalThreadContext property Key: LOG4NET-398 URL: https://issues.apache.org/jira/browse/LOG4NET-398 Project: Log4net Issue Type: Bug Components: Core Affects Versions: 1.2.12 Environment: Visual Studio 2010 Reporter: Thomas Meum I have found that accessing Page.Request.Url after setting a LogicalThreadContext property causes a SerializationException with the following message: Type is not resolved for member 'log4net.Util.PropertiesDictionary,log4net, Version=1.2.12.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a'. I have been able to reproduce the problem on two different machines with the following steps: 1. Create a new ASP.NET Empty Web Application 2. Add a reference to log4net.dll 3. Add a new Web Form 4. Add the following code to Page_Load: log4net.LogicalThreadContext.Properties[Test] = 1; Uri url = Request.Url; 5. Hit F5 -- This message was sent by Atlassian JIRA (v6.1#6144)
[jira] [Comment Edited] (LOG4NET-398) SerializationException after setting a LogicalThreadContext property
[ https://issues.apache.org/jira/browse/LOG4NET-398?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13791231#comment-13791231 ] Dominik Psenner edited comment on LOG4NET-398 at 10/10/13 6:14 AM: --- Hi Where is the SerializationException thrown? Would you mind to post a stacktrace? Are you running log4net on the .NET Compact Framework? was (Author: nachbarslumpi): Hi Where is the SerializationException thrown? Would you mind to post a stacktrace? SerializationException after setting a LogicalThreadContext property Key: LOG4NET-398 URL: https://issues.apache.org/jira/browse/LOG4NET-398 Project: Log4net Issue Type: Bug Components: Core Affects Versions: 1.2.12 Environment: Visual Studio 2010 Reporter: Thomas Meum I have found that accessing Page.Request.Url after setting a LogicalThreadContext property causes a SerializationException with the following message: Type is not resolved for member 'log4net.Util.PropertiesDictionary,log4net, Version=1.2.12.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a'. I have been able to reproduce the problem on two different machines with the following steps: 1. Create a new ASP.NET Empty Web Application 2. Add a reference to log4net.dll 3. Add a new Web Form 4. Add the following code to Page_Load: log4net.LogicalThreadContext.Properties[Test] = 1; Uri url = Request.Url; 5. Hit F5 -- This message was sent by Atlassian JIRA (v6.1#6144)