Uploaded image for project: 'Log4net'
  1. Log4net
  2. LOG4NET-590

LogicalThreadContext stops UnitTest in Visual Studio

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • 2.0.8
    • None
    • Core
    • None

    Description

      Hello,

      I use log4net in my application for logging. In one day unit tests stopped in visual studio. There was error:

      An exception occurred while invoking executor 'executor://mstestadapter/v2': Unable to find assembly 'log4net, Version=2.0.8.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a'.

      I spend much time to find problem.

      I have in my ctor this:

      public Logger()

      {

      log = log4net.LogManager.GetLogger(typeof(Logger));

      log4net.LogicalThreadContext.Properties["LogRunId"] = 0; //get max+1 log from database

      {color:#880000}}

      When I comment second line unit test works fine. When I change LogicalThreadContext to ThreadContext it works fine. If there is LogicalThreadContext error is shown. Why?

      Example application could be found onĀ https://1drv.ms/u/s!AtGI8jaUqSfuiNhRtwmmxkr-YhoWPA

      Attachments

        Activity

          People

            Unassigned Unassigned
            Zefek Petr B
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: