在 WP8 中下载文件时出现 OutOfMemoryException

编程入门 行业动态 更新时间:2024-10-28 20:26:49
本文介绍了在 WP8 中下载文件时出现 OutOfMemoryException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

当我尝试从 Windows 移动应用程序下载大文件(大小 >170 MB)时,我收到此异常

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

System.Windows.ni.dll 中发生类型为System.OutOfMemoryException"的未处理异常

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);

这可能是什么原因?我没有得到关于异常的任何其他详细信息,甚至我试图将 Try-catch 块放在 webclient 下载代码中,但这也没有触发.可能的原因是什么?

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?

推荐答案

关注这篇 MSDN 文章了解更多信息 - Windows Phone 8 的应用内存限制

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

这篇关于在 WP8 中下载文件时出现 OutOfMemoryException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

更多推荐

[db:关键词]

本文发布于:2023-04-25 14:01:39,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1117616.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:文件   OutOfMemoryException

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!