InvalidCastException with cloud layer BKN///

Any discussion related to FSiPanel 2017
Post Reply
Thomas Karsten
Posts: 3
Joined: Sat May 05, 2018 1:49 am

InvalidCastException with cloud layer BKN///

Post by Thomas Karsten » Mon Dec 30, 2019 1:49 pm


In FSiPanel 2017 for Prepar3D version with the METAR

Code: Select all

RJTT 301230Z 01005KT 9999 FEW010 SCT030 BKN/// 10/09 Q1017 NOSIG
I get the following exception:

Code: Select all

30.12 22:08:21   Exception : System.InvalidCastException: Conversion from string "///" to type 'Integer' is not valid. ---> System.FormatException: Input string was not in a correct format.
   at Microsoft.VisualBasic.CompilerServices.Conversions.ParseDouble(String Value, NumberFormatInfo NumberFormat)
   at Microsoft.VisualBasic.CompilerServices.Conversions.ToInteger(String Value)
   --- End of inner exception stack trace ---
   at Microsoft.VisualBasic.CompilerServices.Conversions.ToInteger(String Value)
   at a..(String )
   at FSiPanel2017_P3D.FrmMain.(String )
   at (Object , String )
   at a..(Object , String )
   at FSiPanel2017_P3D.FrmMain.ImportMetar(String Met)
   at (Object , String )
   at a..(Object , String )
   at FSiPanel2017_P3D.FrmMain.ProcessClientOrder(String Order)
   at (Object , String )
   at a..(Object , String )
   at FSiPanel2017_P3D.FrmMain.(Object , EventArgs )
   at System.Windows.Forms.Control.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ButtonBase.WndProc(Message& m)
   at System.Windows.Forms.Button.WndProc(Message& m)
   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)
The METAR is injected from Active Sky Next and is real world data.

When I replace the three slashes that follow BKN by numbers to make it read BKN080, for example, then there is no error message and the application is working as expected.

Kind regards,

Site Admin
Posts: 510
Joined: Fri Sep 15, 2017 10:30 am

Re: InvalidCastException with cloud layer BKN///

Post by jpgarraio » Tue Dec 31, 2019 5:23 am

Hi Thomas,

Thanks for this finding, I will update the code.



Post Reply