FubarDevelopment / FtpServer

Portable FTP server written in .NET
http://fubardevelopment.github.io/FtpServer/
MIT License
473 stars 161 forks source link

StopAsync immediately after StartAsync fails #75

Closed twodogmbh closed 5 years ago

twodogmbh commented 5 years ago

When on the FTP server the method StopAsync is called immediately after StartAsync, the method fails with the following exception:

---> (Inner Exception #0) System.InvalidOperationException: Status must be Running, Stopped, or Paused, but was ReadyToRun.
   at FubarDev.FtpServer.Networking.PausableFtpService.<StopAsync>d__19.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter.GetResult()
   at FubarDev.FtpServer.FtpServer.<StopAsync>d__36.MoveNext()<---

In my opinion, it should also be possible to stop the FTP server in state "ReadyToRun".

The same issue occurs also when calling PauseAsync immediately after StartAsync.

fubar-coder commented 5 years ago

This is a though problem for me and I cannot reproduce this easily, because it's a race condition. Will try on a different machine...

fubar-coder commented 5 years ago

Version 3.0.1 should be out soon.