You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "Vladimir Kloz (JIRA)" <ji...@apache.org> on 2018/08/15 09:04:00 UTC

[jira] [Commented] (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&focusedCommentId=16580864#comment-16580864 ] 

Vladimir Kloz commented on LOG4NET-398:
---------------------------------------

We observed this issue when we attempted to upgrade log4net version due to bugfixes.

When I checked the current log4net code I realized that version for .net standard 1.3 uses a slightly different approach than .NET 4.5 assembly which doesn't affect the .NET remoting logical call context concept.

For us the bad part is that the issue is happening when initializing SqlDependency. Putting assembly into GAC helps locally since the deserialization piece can then locate the assembly properly. But obviously - we do not pass the NDC stuff around.

We migrated our executable to .NET 4.6 and compiled manually log4net to use .NET Standard approach and it seems to resolve the issue.

Unfortunately the logic inside nuget packages seems to prefer .NET 4.5 over the .net standard one.

I am thinking whether it wouldn't be possible to create .NET 4.6 assembly which will use the same logic as the .NET standard to solve this. If you agree I will gladly prepare a pull request.

> 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
(v7.6.3#76005)