Skip to content

ObjectDisposedException in TelnetAppender (3.0.1) #194

@VianneyTremelo

Description

@VianneyTremelo

I migrated two (C#) applications to the version 3.01. And I've now an exception : "System.ObjectDisposedException: 'Cannot access a disposed object. Object name: 'System.Net.Sockets.Socket'.'" (see screenshot below)

  • When the application start on my first migrated application
  • When the application is disposed on my 2nd migrated application

The port that I use is not locked by another application, because if I rollback my changes and run my application with previous version of log4net (v2.0.1) => it's works fine.

My config:

<appender name="TelnetAppender" type="log4net.Appender.TelnetAppender">
  <port value="4060" />
  <layout type="log4net.Layout.PatternLayout">
    <conversionPattern value="%date{HH:mm:ss.fff} %-5level - %message%newline" />
  </layout>
</appender>

Error:

image

(edit - added from https://stackoverflow.com/questions/79053363/log4net-telnetappender-doesnt-work-after-migrate-to-log4net-3)
https://github.com/apache/logging-log4net/blob/Feature/TelnetBug/src/log4net.Tests/Appender/TelnetAppenderTest.cs
I tried to run the UnitTest (TelnetAppenderTest) in Execution mode : OK, no error.
But when I try to run it in debug, I have the same issue (but at the end). When the test tries to dispose the Telnet Client, an error "Cannot access a disposed object" appears (see screenshot link below). It's the issue that I have.
https://snipboard.io/Dnb8Vj.jpg

I migrated two applications: both have the same issue - One at the end, when the application are being to be dispose - The 2nd have the issue at the startup.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions