RobotStudio event

XML Serializer


Hello,
I'm trying to  use  the  xmlSerializer  to  serialize  my  data.
Here  there is  an  example  that  works  correcly in a  windonws form  based  application,  but  not in the  FP application:
Public
Class MyDataClass
Inherits System.Object

Public Program_Name As String = "prg_Name"

Public program_numData As Double = 0


Public Function Save(ByVal XMLPath As String, ByRef mydata As BWProgramData) As Boolean
Try
Dim writer As TextWriter = New StreamWriter(XMLPath)
Dim ser As New XmlSerializer(mydata.GetType)
ser.Serialize(writer, mydata)
writer.Close()
Return True
Catch ex As Exception
Return False
End Try
End Function

What it si  wrong?

Can  you  suggest  alternative  approach?

BR

Oscar

 

 

BR
Oscar Ferrrato

Comments

  • PS: I'm  using  RAB  5.08

    O.

    BR
    Oscar Ferrrato
  • Hi Oscar
    Make sure that you aren't using any classes that aren't supported by .NET compact framework which is used by FP.
    Per Svensson
    Robotics and Vision Specialist
    Consat Engineering
  • Can you be more specific about what the error is and/or how it is failing?

    There are two new pieces of functionality in 5.08 that make this easier: writing debug or trace messages to the robot console and remote device debugging.

    Write Debug messages to console:

    1. Use the Imports (VB) or Using (C#) to access the ABB.Robotics.Diagnostics namespace.

    2. Add debug messages in your code such as Debug.WriteLine("debug message1") or Trace.Writeline("Trace message 1")

    3. Build and deploy your application, restart FlexPendant.

    4. In the console, turn on FlexPendant debug message printing by entering "fpcmd_enable_console_output 3" (no quotes)

    5. Observe the console output for troubleshooting information.

    6. Disable debug output by entering "fpcmd_disable_console_output" (no quotes)

    Remote device debugging:

    With the proper hardware setup, you can use the VS2005 remote debugger to attach to the Taf process, i.e the FlexPendant application itself. When you do this, you can set breakpoints and step through your code to see exactly where it is failing.

    The procedure for performing this type of debugging is described in the product documentation that is supplied with the release version of RAB 5.08.

    RussD2007-2-28 3:1:10
    Russell Drown
  • Hi,

    according  to  the  info in  msdn,  the  XMLSerializer  is  supported  in  .NET compact  framework  2.0:

    http://msdn2.microsoft.com/en-us/library/system.xml.serializ ation.xmlserializer.aspx

    This  is  the  exception  error:

    System.InvalidOperationException was caught
      Message="There was an error generating the XML document."
      Source="System.Xml"
      StackTrace:
           at System.Xml.Serialization.XmlSerializer.Serialize(XmlWriter xmlWriter, Object o, XmlSerializerNamespaces namespaces, String encodingStyle, String id)
           at System.Xml.Serialization.XmlSerializer.Serialize(TextWriter textWriter, Object o)
           at TpsViewBendwareOnBoard.BWProgramData.Save(String XMLPath, BWProgramData& mydata)

    this  log  does  not  say  too  much  too me..

    PS I'm testing  it  on virtual  IRC5

    Thanks

    Oscar

    BR
    Oscar Ferrrato
  • Hi Oscar
    Sounds to me that there is a problem with the file path in some way.
    Per Svensson
    Robotics and Vision Specialist
    Consat Engineering
  • Hello,

    try to put your TpsView...dll additionaly in the vc bin folder of the mediapool you are using. Worked for me in 5.07 (not tested with 5.08 though).

    On a real controller you should be fine...

    best regards

    Ren?

  • Try using the Temp directory on the FlexPendant (which corresponds to LocalDirectory) as the destination where the file will be created, then use FileSystem.PutFile to copy it to the flashdisk after the file is created.
    Russell Drown
  • Hello  again ,

    the  suggestion  from  Renek   works.

    I copied  my  tpsApp  in the  mediapool.

    Oscar

    BR
    Oscar Ferrrato