[Mono-list] Some problems when porting a .NET application from Windows to Linux.

Ventsislav Mladenov ventsislav.mladenov at gmail.com
Wed Jul 16 17:32:14 EDT 2008


I'm using latest Mono and Monodevelop version from trunk from OpenSuse 
11.0 repository.
1. Sqlite ADO.NET drivers
At Windows version I'm using "http://sqlite.phxsoftware.com/" client, 
but at Linux version I'm using Mono.Data.Sqlite.
The problem is that there is different naming of classes 
SQLiteConnection vs SqliteConnection could you uniform naming of classes ?
2. Just before showing of "windows form" application error occurred

    Unhandled Exception: System.ArgumentException: A null reference or
    invalid value was found [GDI+ status: InvalidParameter]
      at System.Drawing.GDIPlus.CheckStatus (Status status) [0x0009d] in
    /tmp/monobuild/build/BUILD/mono-108047/mcs/class/System.Drawing/System.Drawing/gdipFunctions.cs:219

      at System.Drawing.Image.InitFromStream (System.IO.Stream stream)
    [0x000cf] in
    /tmp/monobuild/build/BUILD/mono-108047/mcs/class/System.Drawing/System.Drawing/Image.cs:301

      at System.Drawing.Image.LoadFromStream (System.IO.Stream stream,
    Boolean keepAlive) [0x00011] in
    /tmp/monobuild/build/BUILD/mono-108047/mcs/class/System.Drawing/System.Drawing/Image.cs:162

      at System.Drawing.Icon.GetInternalBitmap () [0x00036] in
    /tmp/monobuild/build/BUILD/mono-108047/mcs/class/System.Drawing/System.Drawing/Icon.cs:558

      at System.Drawing.Icon.ToBitmap () [0x0001b] in
    /tmp/monobuild/build/BUILD/mono-108047/mcs/class/System.Drawing/System.Drawing/Icon.cs:580

      at (wrapper remoting-invoke-with-check)
    System.Drawing.Icon:ToBitmap ()
      at System.Windows.Forms.XplatUIX11.SetIcon
    (System.Windows.Forms.Hwnd hwnd, System.Drawing.Icon icon) [0x00021]
    in
    /tmp/monobuild/build/BUILD/mono-108047/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIX11.cs:1172

      at System.Windows.Forms.XplatUIX11.SetIcon (IntPtr handle,
    System.Drawing.Icon icon) [0x0000d] in
    /tmp/monobuild/build/BUILD/mono-108047/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIX11.cs:5352

      at System.Windows.Forms.XplatUI.SetIcon (IntPtr handle,
    System.Drawing.Icon icon) [0x00000] in
    /tmp/monobuild/build/BUILD/mono-108047/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUI.cs:1025

      at System.Windows.Forms.Form.CreateHandle () [0x0007f] in
    /tmp/monobuild/build/BUILD/mono-108047/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Form.cs:1969

      at System.Windows.Forms.Control.CreateControl () [0x0004b] in
    /tmp/monobuild/build/BUILD/mono-108047/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs:3761

      at System.Windows.Forms.Control.SetVisibleCore (Boolean value)
    [0x00043] in
    /tmp/monobuild/build/BUILD/mono-108047/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs:5055

      at System.Windows.Forms.Form.SetVisibleCore (Boolean value)
    [0x0006e] in
    /tmp/monobuild/build/BUILD/mono-108047/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Form.cs:2410

      at System.Windows.Forms.Control.set_Visible (Boolean value)
    [0x0000c] in
    /tmp/monobuild/build/BUILD/mono-108047/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs:3413

      at (wrapper remoting-invoke-with-check)
    System.Windows.Forms.Control:set_Visible (bool)
      at System.Windows.Forms.Application.RunLoop (Boolean Modal,
    System.Windows.Forms.ApplicationContext context) [0x00059] in
    /tmp/monobuild/build/BUILD/mono-108047/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Application.cs:841

      at System.Windows.Forms.Application.Run
    (System.Windows.Forms.ApplicationContext context) [0x0002e] in
    /tmp/monobuild/build/BUILD/mono-108047/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Application.cs:740

      at System.Windows.Forms.Application.Run (System.Windows.Forms.Form
    mainForm) [0x00000] in
    /tmp/monobuild/build/BUILD/mono-108047/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Application.cs:723

      at SBEDictionary.Program.Main () [0x0001a] in
    /media/mm2/work/SBEDictionary/sbedictionary/trunk/SBEDictionary/SBEDictionary/Program.cs:20


I think I'm missing a lib* file, but I don't know which exactly.

3. Debugger.
    3.1. Can't debug an application:
    http://farm4.static.flickr.com/3175/2675481790_fd32868735.jpg
    3.2 I think it's good to add breakpoint  just clicking on panel 
placed on left side of text editor.

4. System.Xml.Linq
   I have xml file with structure:

    /<?xml version="1.0" encoding="utf-8" ?>/
    /<LocalizationXml>/
    /    <LocalizationCultureList>/

        /      <LocalizationCulture Culture="en">/

            /      <LocalizationObject>/
            /        <Name>Error</Name>/
            /        <Value>Error</Value>/
            /      </LocalizationObject>

            //      <LocalizationObject>/
            /        <Name>ErrorReadingDictionaryFile</Name>/
            /        <Value>Error occurred while reading the dictionary
            file!</Value>/
            /      </LocalizationObject> /

        /      </LocalizationCulture>/

    /    </LocalizationCultureList>      /
    /</LocalizationXml>/

I'm trying to read with statement

XElement doc = XElement.Load(SBEDictionaryConst.LocalizationXML);
    
return new LocalizationCulture
       (from d in doc.XPathSelectElements(String.Format("//" + LOCALIZATION_CULTURE_LIST_TAG + "/" + LOCALIZATION_CULTURE_TAG + "[@Culture='{0}']/" + LOCALIZATION_OBJECT_TAG, Culture))
        select new LocalizationObject(d.Element(NAME_TAG).Value, d.Element(VALUE_TAG).Value));

no success, but 
XElement doc = XElement.Load(SBEDictionaryConst.LocalizationXML);
				
return new LocalizationCulture
       (from d in doc.Elements("LocalizationCultureList")
	from b in d.Elements("LocalizationCulture")
	from c in b.Elements("LocalizationObject")
	select new LocalizationObject(c.Element(NAME_TAG).Value, c.Element(VALUE_TAG).Value));


is working just fine. I think there is a problem in XPathSelectElements 
method ?!?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-list/attachments/20080717/34960c48/attachment.html 


More information about the Mono-list mailing list