ribbons / RadioDownloader

An easy to use application for managing podcast subscriptions and downloads.
https://nerdoftheherd.com/tools/radiodld/
GNU General Public License v3.0
15 stars 11 forks source link

Fixed crash after the RSS server fails to start due to missing permissions #246

Closed ribbons closed 3 years ago

ribbons commented 3 years ago

If the RSS server fails to start due to missing permissions a user-friendly error message is displayed. However, once this is closed the application crashes due to the following unhandled exception:

System.ObjectDisposedException: Cannot access a disposed object. Object name: 'System.Net.HttpListener'.
   at System.Net.HttpListener.CheckDisposed()
   at System.Net.HttpListener.BeginGetContext(AsyncCallback callback, Object state)
   at RadioDld.RssServer.Start() in C:\projects\radiodownloader\Classes\RssServer.cs:line 67
   at RadioDld.Main.Main_Load(Object eventSender, EventArgs eventArgs) in C:\projects\radiodownloader\Forms\Main.cs:line 331
   at System.EventHandler.Invoke(Object sender, EventArgs e)
   at System.Windows.Forms.Form.OnLoad(EventArgs e)
   at System.Windows.Forms.Form.OnCreateControl()
   at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
   at System.Windows.Forms.Control.CreateControl()
   at System.Windows.Forms.Control.WmShowWindow(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   at System.Windows.Forms.Form.WmShowWindow(Message& m)
   at System.Windows.Forms.Form.WndProc(Message& m)
   at RadioDld.GlassForm.WndProc(Message& m) in C:\projects\radiodownloader\Forms\GlassForm.cs:line 71
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

This appears to be caused when RssServer.Start() is called from the main form after the listener fails to initialise correctly in the RssServer ctor.