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
Oscar Ferrrato
Comments
-
PS: I'm using RAB 5.08
O.
BR
Oscar Ferrrato0 -
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 Engineering0 -
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:10Russell Drown0 -
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 Ferrrato0 -
Hi Oscar
Sounds to me that there is a problem with the file path in some way.
Per Svensson
Robotics and Vision Specialist
Consat Engineering0 -
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?
0 -
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 Drown0
-
Hello again ,
the suggestion from Renek works.
I copied my tpsApp in the mediapool.
Oscar
BR
Oscar Ferrrato0
Categories
- All Categories
- 5.5K RobotStudio
- 396 UpFeed
- 18 Tutorials
- 13 RobotApps
- 297 PowerPacs
- 405 RobotStudio S4
- 1.8K Developer Tools
- 250 ScreenMaker
- 2.8K Robot Controller
- 316 IRC5
- 61 OmniCore
- 7 RCS (Realistic Controller Simulation)
- 798 RAPID Programming
- AppStudio
- 3 RobotStudio AR Viewer
- 18 Wizard Easy Programming
- 105 Collaborative Robots
- 5 Job listings