Skip to main content

Microsoft Silverlight

Waiting forever after successful read of json serviceRSS Feed

(0)

Frank Michael Kraft
Frank Mi...

Member

Member

13 points

10 Posts

Waiting forever after successful read of json service

 I have this code:

  

1    public partial class MainPage : UserControl
2        {
3           List mm;  
4           
5           public MainPage()
6            {
7                InitializeComponent();
8    
9                mm = new List();
10   
11               MinMaxChart.DataContext = mm;
12           }
13   
14           void Page_Loaded(object sender, RoutedEventArgs e)
15           {
16               WebClient mvc = new WebClient();
17   
18               mvc.OpenReadCompleted += new OpenReadCompletedEventHandler(mvc_OpenReadCompleted);
19   
20               mvc.OpenReadAsync(new Uri(rootUri + "Chart/MinMaxService"));
21   
22           }
23   
24           void mvc_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e)
25           {
26               DataContractJsonSerializer json = new DataContractJsonSerializer(typeof(List));
27   
28               /*mm.Add(new MinMaxDTEntry
29               {
30                   Date = DateTime.Parse("1.1.2009"),
31                   Average = 320,
32                   Maximum = 400,
33                   Minimum = 200
34               });
35               mm.Add(new MinMaxDTEntry
36               {
37                   Date = DateTime.Parse("1.2.2009"),
38                   Average = 420,
39                   Maximum = 500,
40                   Minimum = 300
41               });
42               mm.Add(new MinMaxDTEntry
43               {
44                   Date = DateTime.Parse("1.3.2009"),
45                   Average = 220,
46                   Maximum = 300,
47                   Minimum = 100
48               });*/
49   
50   
51               mm = (List)json.ReadObject(e.Result);
52   
53           }

  After line 51 after the return of the function the browser (firefox) is still waiting and showing: "transferring data from...."

However the 51 mm assignment works well. mm is filled as should be. 

The same problem happens, if I do not assign the stream to mm, but  the fixed values from line 28 to 48 that are currently commented out.

 Strange things are happening ...

CarlosFigueira
CarlosFi...

Member

Member

113 points

20 Posts

Re: Waiting forever after successful read of json service

Hello,

If you close the stream after using it, does FF still show the "transferring" status?

52            e.Result.Close();

  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities