lprun and log4net

I've had some scheduled LINQPad tasks scripts hanging and it was related to this single line:

(Nuget: log4net)
log4net.LogicalThreadContext.Properties["host"] = "test";
Save a LINQ file in C# statements mode with log4net package and the above line. lprun will run indefinitely.
Other log4net commands work fine. I can isolate the problem to just this single line.

Any clue why lprun is hanging?


  • Easily reproducible with this script: http://share.linqpad.net/8vljpg.linq

    The linqpad is stuck here:

    @ _workSignal.WaitOne(); (with infinite timeout)

    @ _done.WaitOne(); (with infinite timeout)


    This should be re-written to periodically check if the underlying process (user query) is alive and kicking.
  • As a workaround you need to have the Main method in async mode.
    async Task Main() { log4net.LogicalThreadContext.Properties["host"] = "test"; }

    Seems like a deadlock on the thread context when the root is not async.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!