0

While i am trying to download the large files ( of size >170 MB ) from windows mobile application i am getting this exception

An unhandled exception of type 'System.OutOfMemoryException' occurred in System.Windows.ni.dll

Additional information: Insufficient memory to continue the execution of the program.

The strange thing is i am getting the exception only for few files. This is the code i used to download the file

       hpubDownloader = new WebClient();
        hpubDownloader.OpenReadCompleted += (s, e) =>
        {
           //process response
        };
        hpubDownloader.DownloadProgressChanged += (s, e) =>
        {
            int value = e.ProgressPercentage;
            //show progress percentage , and it shows till 98 % after that it goes to exception App_Unhandled exception
        };
        hpubDownloader.OpenReadAsync(url);

What might be the reaosn for this ? I am not getting any other details about exception and even i tried to put Try- catch block in webclient download code , but thats also not firing . What might be the possible reasons?

Pradeep Kesharwani
  • 1,480
  • 1
  • 12
  • 21
Sebastian
  • 4,625
  • 17
  • 76
  • 145

1 Answers1

3

Follow this MSDN article for more information - App memory limits for Windows Phone 8

MemoryLimits

Romasz
  • 29,662
  • 13
  • 79
  • 154
Pradeep Kesharwani
  • 1,480
  • 1
  • 12
  • 21
  • @Romasz Is there any way to override this limitation? Example if my phone memory is 512 MB , is any way to download a file of size 170 MB – Sebastian Feb 06 '14 at 09:42
  • @JMat Surely you can download such a file directly to IsolatedStorage, but if you want to put that into Memory - there can be a problem. I doubt that there is a way to override the limits. – Romasz Feb 06 '14 at 09:51
  • @JMat Surely you could increase memory but that required amount of memory must be available in your device....for more details you could follow above posted link in this post – Pradeep Kesharwani Feb 06 '14 at 09:58
  • @Pradeep What i can see is How to disable features in apps for lower-memory phones. But i did'nt see any explanation on how to do the memory limit actions – Sebastian Feb 06 '14 at 10:16
  • @Romasz How can i do that (Save directly to isolated storage - without saving to memory) ? I posted a question here http://stackoverflow.com/questions/21671157/save-to-isolated-storage-directly-in-wp8 – Sebastian Feb 10 '14 at 07:56