3

When I'm debugging my Silverlight Appliction and I'm using a list internally I cannot hover over the list and see the items inside the list. I just see the RAW view of the list.

If I want to see the items I have to write my own code which is tedious. Is this something normal to Silverlight?

I DO have the correct list view when debugging in normal Console/WPF/... applications.

Example: Silverlight (e.Result is a Dictionary<DateTime, decimal>): silverlight (link: click)

See how there is no 'list view in the first example?

And there in this one, non Silverlight:non silverlight (link: click)

The system is a Windows 7 64-bit, with Visual Studio 2010 and the Silverlight 4 SDK RC2.

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
Anemoia
  • 7,928
  • 7
  • 46
  • 71
  • what's the type of "Result" in the GetWeightDataCompletedEventArgs? – Vitalik May 02 '10 at 16:41
  • It is supposed to be a Dictionary – Anemoia May 03 '10 at 07:17
  • Do you receive the dictionary from an outside source like a web service? – Johannes May 04 '10 at 08:12
  • Can you actually print out the type of e.Result instead of saying what it should be? If you right-click on your Service Reference and click Configure Service Reference, there are multiple choices for handling dictionaries received from an external call. – Ben Hoffstein May 07 '10 at 18:16

3 Answers3

1

Silverlight's Dictionary<> class has a [DebuggerTypeProxy] attribute but it doesn't work in the current release of the toolset. Also mentioned in this thread. Same advice, report the bug at connect.microsoft.com so they are aware of it, hopefully it will be fixed in the official RTM release of the tools.

Community
  • 1
  • 1
Hans Passant
  • 922,412
  • 146
  • 1,693
  • 2,536
1

There is a workaround to dump the contents of the dictionary in the debugger.

  1. To your project, add a reference to the linq dll (e.g. System.Core)

  2. Add the following statement to your source file:

    using System.Linq;

  3. In the watch window, type:

    dic.Take(21)

  4. Then expand the "Results View" group row. This should give you the familiar list of key, value pairs.

[This workaround was reported by rickpastoor on connect.microsoft.com for Bug 557741]

Phillip Ngan
  • 15,482
  • 8
  • 63
  • 79
0

alt text

I tried to send Dictionary from WCF to Silverlight and I can see the data in the debugger. So it should work fine for you too. Maybe there's something about your code?

What exactly "Date" class are you using? Please try DateTime instead as I did.

Heres' my server side code:

public Dictionary<DateTime, decimal> GetDataUsingDataContract()
{
    Dictionary<DateTime, decimal> x = new Dictionary<DateTime, decimal>();
    x[DateTime.Now] = 2;
    x[DateTime.Now.AddDays(2)] = 3;
    return x;
}
Glorfindel
  • 21,988
  • 13
  • 81
  • 109
Fedor
  • 43,261
  • 10
  • 79
  • 89
  • Date was DateTime. I copied your code, and I still get no view of my Dictionary. Just Raw View. :( I assume that you are using 32 bit? – Anemoia May 06 '10 at 12:38
  • e.Result is System.Collections.Generic.Dictionary in my case. It's Silverlight 3. – Fedor May 06 '10 at 13:00