FluentFTP: Disposing a connected AsyncFtpClient throws non-fatal System.InvalidCastException in version 49.0.*
FTP Server OS: Windows
FTP Server Type: FileZilla Server
Client Computer OS: Windows
FluentFTP Version: 49.0.*
Framework: .NET 8
Updating to FluentFTP version 49.0.* and disposing of a connected AsyncFtpClient throws a non-fatal exception to debug output (unsure if this also applies to other client types):
Exception thrown: 'System.InvalidCastException' in System.Private.CoreLib.dll
Reverting to a lower version results in no such exception.
Exception is thrown from this line:
Looks like #1422 introduced it
Logs :
[14:45:08 INF] > Connect(False) (FTP)
[14:45:08 DBG] FluentFTP 49.0.0.0(.NET 6.0) (FTP)
[14:45:08 INF] Connecting to IP #1= ***:21 (FTP)
[14:45:08 DBG] Waiting for a response (FTP)
[14:45:08 DBG] Response: 220-FileZilla Server 1.7.3 (FTP)
[14:45:08 INF] Response: 220 Please visit https://filezilla-project.org/ [738920.823d] (FTP)
[14:45:08 INF] Status: Detected FTP server: FileZilla (FTP)
[14:45:08 INF] Command: USER *** (FTP)
[14:45:08 DBG] Waiting for response to: USER *** (FTP)
[14:45:08 INF] Response: 331 Please, specify the password. [29ms] (FTP)
[14:45:08 INF] Command: PASS *** (FTP)
[14:45:08 DBG] Waiting for response to: PASS *** (FTP)
[14:45:08 INF] Response: 230 Login successful. [68ms] (FTP)
[14:45:08 INF] Command: FEAT (FTP)
[14:45:08 DBG] Waiting for response to: FEAT (FTP)
[14:45:08 DBG] Response: 211-Features:
Response: MDTM
Response: REST STREAM
Response: SIZE
Response: MLST type*;size*;modify*;perm*;
Response: MLSD
Response: AUTH SSL
Response: AUTH TLS
Response: PROT
Response: PBSZ
Response: UTF8
Response: TVFS
Response: EPSV
Response: EPRT
Response: MFMT (FTP)
[14:45:08 INF] Response: 211 End [57ms] (FTP)
[14:45:08 INF] Text encoding: System.Text.UTF8Encoding+UTF8EncodingSealed (FTP)
[14:45:08 INF] Command: SYST (FTP)
[14:45:08 DBG] Waiting for response to: SYST (FTP)
[14:45:08 INF] Response: 215 UNIX emulated by FileZilla. [30ms] (FTP)
[14:45:08 DBG] Active ServerHandler is: FileZilla (FTP)
[14:45:08 DBG] Listing parser set to: Machine (FTP)
[14:45:09 INF] Command: PWD (FTP)
[14:45:09 DBG] Waiting for response to: PWD (FTP)
[14:45:09 INF] Response: 257 "/" is current directory. [29ms] (FTP)
[14:45:09 INF] > Dispose() (FTP)
[14:45:09 DBG] Disposing FtpClient object... (FTP)
Exception thrown: 'System.InvalidCastException' in System.Private.CoreLib.dll
[14:45:09 DBG] Closing/Disposing FtpSocketStream(control connection) (FTP)
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 42 (16 by maintainers)
Commits related to this issue
- Merge pull request #1464 from FanDjango/master Initial fix for #1461 — committed to robinrodricks/FluentFTP by FanDjango 3 years ago
Added some more small code changes to fix some glitches this caused in SYNC mode, of all places. Closing this now and thanks for the inpur
It probably is, but I’d make sure
m_stream.DisposeAsync/Stream.DisposeAsyncis callingFtpSocketStream.Dispose.