Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6062169
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T09:01:15+00:00 2026-05-23T09:01:15+00:00

In Silverlight, say we start an async request: var request = WebRequest.Create(uri); and then

  • 0

In Silverlight, say we start an async request:

var request = WebRequest.Create(uri);

and then wait for a response via a delegate

request.BeginGetResponse(getResponseResult => ...

How do we timeout this waitee, to deliver a time-out error signal to the delegate instead? Use a timer? (note: timeout options available in the .net framework are missing in the Silverlight version).

To handle two messages arriving at the same time, we could introduce a Guid filter, and then ignore a 2nd message when/if it was delivered to the delegate. Or in reverse (better), we register an expiring Guid so that the delegate can discard a second message — at least some garbage collection is possible then (although the memory footprint of a delegate has got to be on the small side).

What follows are some notes I’ve made. I haven’t reached a conclusion yet. Any help much appreciated.


My line of enquiry was going to be to implement a timer, notify the callback, and then somehow cancel waiting delegate in request.BeginGetResponse(…).

Note:

  • While the .Net Frame Work 4 implements a timeout on the WebRequest class, the Silverlight version does not.

  • "System.Threading.Task.Wait Method (TimeSpan)" is not available either

QUESTION 1: is there a better way to implement a timeout error to the same delegate target?

QUESTION 2: To cancel the waiting delegate, is it sufficient to use "request.BeginGetResponse(null)"?

QUESTION 3: will a non executed delegate (e.g. getResponseResult => …) cause a small memory leak? Is this just a minor concern?


Information on creating a timer:

  • System.Windows.Threading.DispatcherTimer

  • http://blog.bodurov.com/How-to-Create-setTimeout-Function-in-Silverlight

Some References:

  • http://msdn.microsoft.com/en-us/library/system.servicemodel.channels.binding.opentimeout(v=VS.95).aspx (seems to be WCF related)

  • http://msdn.microsoft.com/en-us/library/system.servicemodel.channels.binding.receivetimeout(v=VS.95).aspx (seems to be WCF related)

  • http://blog.bodurov.com/How-to-Create-setTimeout-Function-in-Silverlight (could be useful)

  • Silverlight, dealing with Async calls (no new information)

  • http://petesbloggerama.blogspot.com/2008/07/omg-silverlight-asynchronous-is-evil.html (I want to deal with Async properly… I’ve got some good techniques, but I want to ensure that I’m using them cleanly. Probably I need to look into delegates more closely).

  • http://msdn.microsoft.com/en-us/library/dd460717.aspx#CommunityContent

  • http://csharperimage.jeremylikness.com/2010/03/sequential-asynchronous-workflows-in.html (some good information. Still haven’t found out what to do about infinitely waiting delegates).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T09:01:15+00:00Added an answer on May 23, 2026 at 9:01 am

    If you feel like giving reactive extensions a try you will get time out support for cheap. With Rx it will look something like this (not exact code):

    var obsrv = Observable.FromAsyncPattern<...>(Begin..., End...);
    obsrv(...).Timeout(new TimeSpan(0,0,5)).Subscribe(() => DoThings());
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If I use the navigation framework in silverlight and say mainFrame.Navigate(URI), does this always
Is Silverlight a subset of WPF? If i learn WPF then can i say
I have a silverlight control, for arguments sake let's say it inherits from the
I have a class that returns an IEnumerable. I then execute these tasks in
I have developed a silverlight 3 application using Sockets connecting to a socket server
I'm creating Silverlight application. I need to make some shape blinking few times. Here
Lets say I have a Canvas with one Image centered on the screen. When
Silverlight 4, Toolkit During dragging an item on TARGET CONTROL, there are NOT visible
Say you have an domain entity with business logic for initializing its default values.
I've written 1 WPF app. A pretty simple app. It works great and is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.