OutOfMemoryException when uploading files in WP8

While I'm trying to download large files (> 170 MB in size) from a Windows Mobile application, I get this exception

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

Additional Information: Not enough memory to continue running the program.

The strange thing: I get an exception for only a 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 could be for this? I don't get any other details about the exception, and even I tried to put a Try-catch block in the webclient loading code, but that also fails. What could be the possible reasons?

0
source share
1 answer
+3

Source: https://habr.com/ru/post/1525374/


All Articles