views:

99

answers:

2

I just had a laptop crash (spilled water on it). I copied my working code (2 days ago backup) from a Windows Server 2008 laptop to a Vista laptop running Visual Studio 2008 SP1. Both are running .NET 3.5 SP1.

I have a web method call which is returning product information.

Some of the fields in the web service (running on a hosted server) are as follows :

public class Product
{
    [XmlAttribute("sku")]
    public string SKU;

    [XmlAttribute("name")]
    public string Name;

    [XmlAttribute("category")]
    public string CategoryName;

    [XmlAttribute("categoryKey")]
    public string CategoryKey;

    public List<ProductSectionInfo> Sections;

    public List<MediaItem> MediaItems;

    public string Foo = "bar";
}

public class MediaItem
{

    [XmlAttribute("type")]
    public string Type;

    [XmlAttribute("imageKey")]
    public string ImageKey;

    [XmlAttribute("path")]
    public string Path;

    [XmlAttribute("thumbnailPath")]
    public string ThumbnailPath;

    [XmlAttribute("thumbnailImageKey")]
    public string ThumbnailImageKey;

    [XmlAttribute("selectable")]
    public bool Selectable;
}

When I run a 'GetProduct' web method the 'Sections' property is being populated in my C# client (on the new laptop) but the 'MediaItems' property is not. It just comes out as null in the watch window.

So I look in Fiddler and both are populated in the XML. Both are Lists, being defined in my proxy as standard [] arrays.

You may have noticed I added a 'Foo' property above. I did this on the server, recompiled and recreated the web-reference. I was able to verify that in the client the 'Foo' property did come across. So its not that 'MediaItems' is capitalized or anything like that.

I'm pretty convinced that there's something on this new laptop that is different from the other. I hadn't really written anything new, had made only changes elsewhere. And I didn't even recreate the service reference proxy until I noticed an issue. Another instance of my client running on a test server is running fine hitting the same service.

Fixed laptop is coming back tomorrow, but I'd really like to get to the bottom of this. I'm pretty puzzled. I've seen all kinds of weird things like this before but really cant see whats going on here. Can I debug into the proxy somehow?

A: 

Most of the issues I have had with parts of a message not loading properly are usually a difference between the proxy and the service. Usually either something changed/moved, or even xml namespace changes/issues.

eglasius
A: 

I knew this was the kind of issue that as soon as I poseted something it would solve itself - and of course it was.

I still have no clue WHY. The fact that I was able to add a 'Foo' property, regenerate the proxy and it still didn't work is very wierd.

  • I added a new 'MediaItems2' property and assigned an empty 'MediaItem' to it

    MediaItems2 = new List(new MediaItem[] {new MediaItem()})

  • I generated a new proxy
  • Everything worked
  • I deleted 'MediaItems2' from the web service
  • I generated a new proxy
  • It still worked

Still very puzzled though. This is the very first time this project (ASP.NET MVC) has been even run on this laptop.

Oh well, back to work....

Simon_Weaver