It seems to be the same as this bug posted by Wally

 

http://bugzilla.xamarin.com/show_bug.cgi?id=219

 

Jon

 

Von: Rodrigo Kumpera [mailto:kump...@xamarin.com] 
Gesendet: 24 August 2011 17:31
An: Jon Hopkins
Cc: monotouch@lists.ximian.com
Betreff: Re: [MonoTouch] Xml Linq bug

 

HI Jon,

 

Given you managed the hard part of coming up with a test case, mind
filling up a bug so it can

be fixed?

 

Thanks,

Rodrigo

On Wed, Aug 24, 2011 at 11:36 AM, Jon Hopkins <jon.hopk...@bgagroup.net>
wrote:

Fortunately, it is just a debugger problem, and on the device it is
working.

 

Von: monotouch-boun...@lists.ximian.com
[mailto:monotouch-boun...@lists.ximian.com] Im Auftrag von Jon Hopkins
Gesendet: 24 August 2011 16:16
Cc: monotouch@lists.ximian.com
Betreff: [MonoTouch] Xml Linq bug

 

Hi,

 

I have a class that I use to store a recursive object that is populated
via Linq from Xml. The code is pretty

Simple and works in Visual Studio, but in MT, the sub-objects exist but
are garbage collected and NULL

When you inspect them.

 

using System;

using System.Xml.Linq;

using System.Collections.Generic;

using System.Linq;

 

    public class pageObj

    {

        public string bgImage = "";

        ......

        public List<pageObj> subpages;

 

        public pageObj() { }

 

        public pageObj(XElement el)

        {

            if (el.Element("bgimage") != null)

                bgImage = el.Element("bgimage").Value ?? "";

            ...........

            if (el.Element("subpages") != null)

            {

                var myref = subpages;                  // try and keep a
ref

                subpages = el.Element("subpages")

                    .Descendants("subpage")

                   .Select(e => new pageObj(e))

                   .ToList();

            }

 

        }

    }

 

.....

Initialised with

 

pages = xmlDoc

                .XPathSelectElements("magazine/page")

                .Select(e => new pageObj(e))

                .ToList();

 

Thanks,

 

Jon


_______________________________________________
MonoTouch mailing list
MonoTouch@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/monotouch

 

_______________________________________________
MonoTouch mailing list
MonoTouch@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/monotouch

Reply via email to