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 8662083
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T16:38:59+00:00 2026-06-12T16:38:59+00:00

I am testing my WPF application connecting to Azure Blob Storage to download a

  • 0

I am testing my WPF application connecting to Azure Blob Storage to download a bunch of images using TPL (tasks).
It is expected that in Live environment, there will be highly transient connection to the internet at deployed locations.

I have set Retry Policy and time-out in BlobRequestOptions as below:

//Note the values here are for test purposes only
//CloudRetryPolicy is a custom method returning adequate Retry Policy
// i.e. retry 3 times, wait 2 seconds between retries
blobClient.RetryPolicy = CloudRetryPolicy(3, new TimeSpan(0, 0, 2));

BlobRequestOptions bro = new BlobRequestOptions() { Timeout = TimeSpan.FromSeconds(20) };
blob.DownloadToFile(LocalPath, bro);

The above statements are in a background task that work as expected and I have appropriate exception handling in background task and the continuation task.

In order to test exception handling and my recovery code, I am simulating internet disconnection by pulling out the network cable. I have hooked up a method to System.Net.NetworkChange.NetworkAvailabilityChanged event on UI thread and I can detect connection/disconnection as expected and update UI accordingly.

My problem is: If I pull the network cable while a file is being downloaded (via blob.DownloadToFile), the background thread just hangs. It does not timeout, does not crash, does not throw exception, nothing!!! As I write, I have been waiting ~30 mins and no response/processing has happened in relation to background task.

If I pull the network cable, before download starts, execution is as expected. i.e. I can see retries happening, exceptions raised and passed ahead and so on.

Has anyone experienced similar behaviour? Any tips/suggestions to overcome this behaviour/problem?

By the way, I am aware that I can cancel the download task on detection of network connectivity loss, but I do not want to do this as network connectivity can get restored within the time-out duration and the download process can continue from where it was interrupted. I have tested this auto resumption and works nicely.

Below is a rough indication of my code structure (not syntactically correct, just a flow indication)

btnClick()
{
  declare background_task
  attach continuewith_task to background task
  start background task
}

background_task()
{
  try
  {
    ... connection setup ... 
    blob.DownloadToFile(LocalPath, bro);
  }
  catch(exception ex)
  {
     ... exception handling ....
     // in case of connectivity loss while download is in progress
     // this block is not getting executed
     // debugger just sits idle without a current statement
  }
}

continuewith_task()
{
  check if antecedent task is faulted
  {
     ... do recovery work ...
     // this is working as expected if connectivity is lost
     // before download starts
     // this task does not get called if connectivity is lost
     // while file transfer is taking place
  }
  else
  {
     .. further processing ...
  }
}
  • 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-06-12T16:39:00+00:00Added an answer on June 12, 2026 at 4:39 pm

    Your problem is mainly caused because Azure storage client libraries uses file streaming classes underneath and that why the API hang is not directly related with Windows Azure Blob client library. Calling file streaming API directly over network you can see the exact same behavior when network cable is suddenly removed, however removing network gracefully will return different behavior.

    If you search on internet you will find streaming classes does not detect the network loss and that’s why in your code you can check the network disconnect event and then stop the background streaming thread.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have WPF application. After testing my app on Windows7 and realized that opening
I am using WiPFlash to automate some testing in a WPF application. I need
I have a solution that has three projects: WPF Application Class Library NUnit Testing
We were testing our WPF application on Windows XP in the VMware Player (with
I'm working on my first WPF application and I'm testing out a custom control
I am trying to create a user control within a WPF application that will
We have a WPF windows application that contains a stackpanel control, that I want
I have a WPF app that I'm testing on a Samsung XE700T1A tablet. I
I am considering to write smoke tests for our WPF application. The question that
I'm writing a WPF application that displays terrain in 3D. When I perform hit

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.