chuyiyang

An issue from my PISDK C# development program recently found while running on the OPCHDA interface node

Discussion created by chuyiyang on Oct 23, 2014
Latest reply on Dec 2, 2014 by Lonnie Bowling

Hi PISDK specialist,

 

I wrote a PISDK program in C# code.  It's been running for over 2 months and no such issue until lately on 3 days ago.  I still can run the same program on my laptop without such issue.

 

I tried to pin point the issue and found that it is related to a C# statement as follows:

 

listBox1.Items.Add(tagNames + "\t" + TempValue.TimeStamp.LocalDate.ToString("dd-MMM-yyyy HH:mm:ss",

 

                                    System.Globalization.CultureInfo.InvariantCulture) + "\t" + TempValue.Value);

 

The error I got is related to "Specified cast is not valid".

 

On our network, I think there may be something recently changed on the server admin updates which may affect my program run.  This issues were found on 3 different interface nodes which I have my program installed. I tried to duplicate my issue from my own laptop which is also connected to the network but I do not have such issue.

 

Please advise what may cause such error.  Is there any alternative methods I can work around this?

 

 

 

Thanks in advance,

 

Chuck

 

[Other detailed error messages listed below:]

 

See the end of this message for details on invoking

 

just-in-time (JIT) debugging instead of this dialog box.

 

 

 

************** Exception Text **************

 

System.InvalidCastException: Specified cast is not valid.

 

   at CSharpSnaphot.Form1.button3_Click(Object sender, EventArgs e)

 

   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)

 

 

 

 

 

************** Loaded Assemblies **************

 

mscorlib

 

    Assembly Version: 2.0.0.0

 

    Win32 Version: 2.0.50727.5466 (Win7SP1GDR.050727-5400)

 

    CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll

 

----------------------------------------

 

PISDKIFChk1

 

    Assembly Version: 1.0.5318.25753

 

    Win32 Version: 1.0.5318.25753

 

    CodeBase: file:///C:/Users/upscada-dknrs166-rt/AppData/Local/Apps/2.0/3Y1KG32Z.LOY/LHJGLB4D.8CD/pisd..tion_e8a7a0b22eac7758_0001.0000_733cf94ebdaccbcf/PISDKIFChk1.exe

 

----------------------------------------

 

System.Windows.Forms

 

    Assembly Version: 2.0.0.0

 

    Win32 Version: 2.0.50727.5468 (Win7SP1GDR.050727-5400)

 

    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll

 

----------------------------------------

 

System

 

    Assembly Version: 2.0.0.0

 

    Win32 Version: 2.0.50727.5467 (Win7SP1GDR.050727-5400)

 

    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll

 

----------------------------------------

 

System.Drawing

 

    Assembly Version: 2.0.0.0

 

    Win32 Version: 2.0.50727.5467 (Win7SP1GDR.050727-5400)

 

    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll

 

----------------------------------------

 

System.Configuration

 

    Assembly Version: 2.0.0.0

 

    Win32 Version: 2.0.50727.5420 (Win7SP1.050727-5400)

 

    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Configuration/2.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll

 

----------------------------------------

 

System.Xml

 

    Assembly Version: 2.0.0.0

 

    Win32 Version: 2.0.50727.5420 (Win7SP1.050727-5400)

 

    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll

 

----------------------------------------

 

OSIsoft.PISDK

 

    Assembly Version: 1.4.0.0

 

    Win32 Version: 1.4.0.416

 

    CodeBase: file:///C:/Windows/assembly/GAC_32/OSIsoft.PISDK/1.4.0.0__c3309f0734ba2805/OSIsoft.PISDK.dll

 

----------------------------------------

 

OSIsoft.PISDKDlg

 

    Assembly Version: 1.3.0.0

 

    Win32 Version: 1.8.0.412

 

    CodeBase: file:///C:/Windows/assembly/GAC_32/OSIsoft.PISDKDlg/1.3.0.0__c3309f0734ba2805/OSIsoft.PISDKDlg.dll

 

----------------------------------------

 

OSIsoft.PITimeServer

 

    Assembly Version: 1.4.0.0

 

    Win32 Version: 1.4.0.416

 

    CodeBase: file:///C:/Windows/assembly/GAC_32/OSIsoft.PITimeServer/1.4.0.0__c3309f0734ba2805/OSIsoft.PITimeServer.dll

 

----------------------------------------

 

OSIsoft.PISDKCommon

 

    Assembly Version: 1.4.0.0

 

    Win32 Version: 1.4.0.416

 

    CodeBase: file:///C:/Windows/assembly/GAC_32/OSIsoft.PISDKCommon/1.4.0.0__c3309f0734ba2805/OSIsoft.PISDKCommon.dll

 

----------------------------------------

 

CustomMarshalers

 

    Assembly Version: 2.0.0.0

 

    Win32 Version: 2.0.50727.5420 (Win7SP1.050727-5400)

 

    CodeBase: file:///C:/Windows/assembly/GAC_32/CustomMarshalers/2.0.0.0__b03f5f7f11d50a3a/CustomMarshalers.dll

 

----------------------------------------

 

 

 

************** JIT Debugging **************

 

To enable just-in-time (JIT) debugging, the .config file for this

 

application or computer (machine.config) must have the

 

jitDebugging value set in the system.windows.forms section.

 

The application must also be compiled with debugging

 

enabled.

 

 

 

For example:

 

 

 

<configuration>

 

    <system.windows.forms jitDebugging="true" />

 

</configuration>

 

 

 

When JIT debugging is enabled, any unhandled exception

 

will be sent to the JIT debugger registered on the computer

 

rather than be handled by this dialog box.

 

 

 

 

 

 

 

 

 

 

 

 

Outcomes