[Mono-list] Advice about problems running code across different Operating systems

alanb alan.battersby at ntlworld.com
Thu Sep 10 16:37:38 EDT 2009



Chris Howie wrote:
> 
> It's impossible to help without knowing what exception was thrown.
> Run the application from a terminal on Ubuntu and look for the
> exception being thrown, as well as the stack trace.
> 

Ok I spent some time today on this and I think I know the problem. My
program keeps project information in an XML file , read and written using
serialization.  Opensuse handles this correctly but when running on Ubuntu
it appears that strings are not read in correctly by my code

This is the info file  http://www.nabble.com/file/p25390548/project.info
project.info  actually its the base class I am reading into a derived class
called RoseProjectInfo but it shows the problem.

This is info file source 
http://www.nabble.com/file/p25390548/ProjectInfo.cs ProjectInfo.cs .
This is my Serialization code works on Opensuse 
http://www.nabble.com/file/p25390548/Serializer.cs Serializer.cs 


This is what ToString displays after reading deserializing the base class.
See that ProjectName seems to be null as do SurfaceFilename and the value of
Tool

[ProjectInfo: Accuracy=2, ProjectType=ROSE_ENGINE, ProjectName=,
UseSurface=False, SurfacePreMachined=False, AngularScale=10, RadialScale=10,
Grid_Radius=200, FollowSurface=False, SurfaceFilename=,
UseRotaryTable=False, HeadstockAxis=Z, ToolMoventAxis=X, ToolDepthAxis=Y,
ToolHeightAxis=X, CNCRotaryAxis=Z, CNCToolMovementAxis1=X,
CNCToolMovementAxis2=Y, CNCToolMovementAxis3=Z, CodeEngineType=Absolute,
Machining_Data=Utils.MachiningData, Tooltable=Utils.ToolTable, Tool=,
FrontFaceColorAsInt=-984833, FrontFaceColor=Color [AliceBlue],
AxialMode=False, FaceMode=True]

The exception is generated because I am trying to use another string in the
derived class as the name of a file to be read in which is null.

Exception in Gtk# callback delegate
  Note: Applications can use GLib.ExceptionManager.UnhandledException to
handle the exception.
System.NullReferenceException: Object reference not set to an instance of an
object
  at MainWindow.LoadHeadstock () [0x00000] 
  at MainWindow.LoadProjectFromInfo () [0x00000] 
  at MainWindow.OnOpenProjectActionActivated (System.Object sender,
System.EventArgs e) [0x00000] 
  at GLib.Signal.voidObjectCallback (IntPtr handle, IntPtr data) [0x00000] 
   at GLib.ExceptionManager.RaiseUnhandledException(System.Exception e,
Boolean is_terminal)
   at GLib.Signal.voidObjectCallback(IntPtr handle, IntPtr data)
   at GLib.Signal.voidObjectCallback(IntPtr , IntPtr )
   at Gtk.Application.gtk_main()
   at Gtk.Application.gtk_main()
   at Gtk.Application.Run()
   at OTWorkbench.MainClass.Main(System.String[] args)

So is it a bug in my code or in mono or in Ubuntu? I would be grateful for
any help, this is a hobby project.

Alan

-- 
View this message in context: http://www.nabble.com/Advice-about-problems-running-code-across-different-Operating-systems-tp25374628p25390548.html
Sent from the Mono - General mailing list archive at Nabble.com.



More information about the Mono-list mailing list