How to increase the time for timeout exception in windows phone? - windows-phone-8

In my windows phone app, i'm using HttpWebRequest for getting an image.But i'm getting exception.
When i checked out the stream, ReadTimeout exception has been thrown.
How can i increase the time?? because the data i'm getting is quite large.

According to the documentation, there is a Timeout property on HttpWebRequest that you can set.
Alternatively you can use Background file transfers, if your data is large.

Related

WinInet FtpOpenFile timeout

I have an app that regularly uploads file using WinInet's FTP functions. It's been running for years but started failing on 4/1/2021. It fails opening a file using FtpOpenFile with a status of 12002 Internet Timeout. The call looks like this..
hiOpenFile = FtpOpenFile(
hiSiteConnect,
"TEMP.htm",
GENERIC_WRITE,
FTP_TRANSFER_TYPE_ASCII,
NULL
);
The file does get created on the server.
I'm wondering what the time out value for this function is and if there is anyway to change it?
I kept getting 12002 Internet Timeout with both FtpOpenFile and FtpGetFile but both work now after adding the INTERNET_FLAG_PASSIVE flag to my InternetConnect call.
Regarding timeouts, normally you would use INTERNET_OPTION_CONNECT_TIMEOUT,INTERNET_OPTION_RECEIVE_TIMEOUT, or INTERNET_OPTION_SEND_TIMEOUT with InternetSetOption. See here for details on the option flags: https://learn.microsoft.com/en-us/windows/win32/wininet/option-flags
However, due to a very old MS bug, setting the timeout as above simply has no effect whatsoever. There is a workaround to reduce the timeout but not to increase. It is done by creating a new worker thread and waiting for it. See here for the article:
https://mskb.pkisolutions.com/kb/224318

Limit size of the REST request (GET)

I use Act.Framework for long requests, but I've noticed that the (JSON) response is truncated.
Is there any limit in the response size?
Ahmed
ActFramework does not limit response size. If you keep getting the error, please fire a bug to https://github.com/actframework/actframework with the following information:
version of actframework
java version
operations sytem
hardware info, CPU, RAM
is your app running in DEV mode or PROD mode
Better come up with a sample project that can reproduce the issue

how to load high resolution image windows phone taskagent? [out of memory]

As we know, it is only 11.5MB memory that can be used in a Windows Phone 8 task agent. I was trying to make dynamic lock screen image in the background task agent. When I get the 480*800 image, it works fine but when I change it to 768*1280 I the exception:
Out of memory
1 pixel cast 4 K
so
(480*800*4)/1024/1024=1.46M
(768*1280*4)/1024/1024 = 3.75M
When I tried to convert a byte[] to a BitmapImage:
public BitmapImage ConvertDownloadStringToStream(byte[] downloadImageBytes)
{
if (!(downloadImageBytes.Length > 0))
return null;
RationImageInfo currentRationInfor = GetBitmapImageWidthByDeveiceRatio();
BitmapImage convertBitmapImage = new BitmapImage() { DecodePixelWidth =768, DecodePixelHeight = 1280};
using (MemoryStream imageStream = new MemoryStream(downloadImageBytes))
{
convertBitmapImage.SetSource(imageStream);//out of memory
}
return convertBitmapImage;
}
I get the out of memory exception at SetSource() method. Does anyone have suggestions about this?
I'm guessing the memory adds up.
Try saving it to a file, free the variable/resource, than load it from the file using the constructor parameter.
just try some many times i has been fix this problem.
as you see it was only have 11M memory can be use in windows phone taskagent. i was tring to make dynamic lock screen background. my soluction is download image from sever side and save to local display it.
why got out of memory Exception?
download image Byte[]=>Write to memory=>build writeableBitmap with 768*1280.
same image memory just cast three time .
so how to fix it ?
when you download your image from server side. you should be save to local isolate storage immediately and clear memory useage about the image byte[]. just set the image url to lockscreen . got be work.
download image Byte[]=>Save To local =>clear image byte memory.
everything is fine.

Generate Windows Phone 8 Crash Dumps

Does anyone know of a way that I can configure a Windows Phone 8 to generate Crash Dumps for applications that are being developed?
I know that we can get access to dumps that are sent to the MS app store, but I need a dump of an application that is still in development.
Thanks
In "App.xaml.cs" class you will find a method called "Application_UnhandledException". This method is launched every time that your app crashes due an unhandled exception. In the event args you will find the error message, stack trace, etc...
Add your logic here to dump the crash (for example, send an email, or store the log in a database, etc...)
BTW, if the exception is recoverable, you can handle the error and don't close the app setting the Handled variable to true:
// Recover from the error
e.Handled = true;

FireFox localStorage reach maximum size while there are only 800 KB data in it

I met an localStorage exception when I call API "localStorage.setItem()"
we are developing a web site, we used host like aaaa.bb.com the case is :
the localStorage already has about 560KB Data and then I want to set a new item into localStorage, the new item is a serialized Json Object, the size is about 301KB.
The way I used to test the size of localStorage is: JSON.stringify(localStorage).length
then the browser throw exception, the content of the exception is as follows:
"Persistent Storage maximum size reached" code:"1014" nsresult: "0x80530f6(NS_ERROR_DOM_QUOTA_REACHED)"
I tested this function in firefox on other machines and in chrome, this exception will not occur, I want to know why this exception occurs on the machine, if there is any settings in firefox? or if there is any relationship with the cache size?