NCrontabViewer throwing InvalidCastException
jdmallen opened this issue · comments
This line and this line each fail to be casted to ISupportInitialize
. Looks like ToolStripStatusLabel
no longer inherits from that interface in .NET 5.0. Commenting out both the lines allows the program to run just fine.
System.InvalidCastException
HResult=0x80004002
Message=Unable to cast object of type 'System.Windows.Forms.ToolStripStatusLabel' to type 'System.ComponentModel.ISupportInitialize'.
Source=System.Private.CoreLib
StackTrace:
at System.Runtime.CompilerServices.CastHelpers.ChkCast_Helper(Void* toTypeHnd, Object obj)
at System.Runtime.CompilerServices.CastHelpers.ChkCastInterface(Void* toTypeHnd, Object obj)
at NCrontabViewer.MainForm.InitializeComponent() in D:\git\NCrontab\NCrontabViewer\MainForm.Designer.cs:line 44
at NCrontabViewer.MainForm..ctor() in D:\git\NCrontab\NCrontabViewer\MainForm.cs:line 46
at NCrontabViewer.Program.Main() in D:\git\NCrontab\NCrontabViewer\Program.cs:line 37
System.InvalidCastException
HResult=0x80004002
Message=Unable to cast object of type 'System.Windows.Forms.ToolStripStatusLabel' to type 'System.ComponentModel.ISupportInitialize'.
Source=System.Private.CoreLib
StackTrace:
at System.Runtime.CompilerServices.CastHelpers.ChkCast_Helper(Void* toTypeHnd, Object obj)
at System.Runtime.CompilerServices.CastHelpers.ChkCastInterface(Void* toTypeHnd, Object obj)
at NCrontabViewer.MainForm.InitializeComponent() in D:\git\NCrontab\NCrontabViewer\MainForm.Designer.cs:line 176
at NCrontabViewer.MainForm..ctor() in D:\git\NCrontab\NCrontabViewer\MainForm.cs:line 46
at NCrontabViewer.Program.Main() in D:\git\NCrontab\NCrontabViewer\Program.cs:line 37
Thanks for reporting this! Feel free to send a PR if you wish to receive credit otherwise I'll close this issue when I get round to fixing it.
I'm not sure the best approach to fixing it, as I'm not terribly familiar with what ISupportInitialize
does. I do know that it seems to work fine with the line omitted; I see a status bar with "Ready" at the bottom of the window. If that's the best solution, I'll happily remove the two offending lines in a PR.
I put a PR in anyway for you to merge at your discretion. Thanks!