AppWarp Xamarin KeepAliveTimer Always Expires

0 votes


I am working on an app using the AppWarp SDK for Xamarin.Android on my HTC EVO 4G LTE running Android 4.1.1 and for some reason once I connect to AppWarp after a short period of time (between 5-60 seconds) I always get a SocketException thrown that says "The socket is not connected". When I look at the call stack I see this:

System.Net.Sockets.Socket.get_RemoteEndPoint () in 
com.shephertz.app42.gaming.multiplayer.client.ClientChannel.Send (data={byte[256]}, length=16) in 
com.shephertz.app42.gaming.multiplayer.client.ClientChannel.SendRequest (msg={ l 0 : 329103763 : }) in 
com.shephertz.app42.gaming.multiplayer.client.ClientChannel.keepAliveTimerExpired (source=(null)) in
System.Threading.Timer.Scheduler.TimerCB (o={System.Threading.Timer}) in
So it seems like the keepAliveTimer keeps expiring too quickly for some reason.
If I test on the Android emulator it happens a lot less frequently but I have also encountered it there. Is there any way you can help me with this? Perhaps by simply increasing the timer length before it expires as it is essentially making AppWarp unusable on my device and I really don't think there is much I can do to fix it.
asked May 14, 2015 in AppWarp by feraask (45 points)
Hi feraask,

We are looking into this issue. I will reply you back as soon as possible once we have found some solution.


1 Answer

0 votes
Hi Ferask,

I tested one of your projects that you sent earlier for AppWarp Xamarin SDK. I am unable to generate the same error as you posted. For us, no such error is being reproduced. Can you please provide us more details? How often does the error occur? Can you share some logs?

answered May 18, 2015 by Suyash Mohan (900 points)
So I've done more testing and it seems to only be occurring on my EVO 4G LTE device (which is on Android 4.1.1) but it always happens on that device I literally cannot use AppWarp on the EVO because it will always crash. All I do is connect to AppWarp (which is successful) and then wait and always within the first minute the app will crash because the keepAliveTimer expires and throws an exception. I'm not sure if it is an issue with that specific version of android or just the EVO 4G LTE but I've tried it on a different device running Android 4.4.4 and 5.0 and AppWarp works fine so far.

I'll try to get a log from the EVO device and post it.
We don't have a EVO device right now, so we will need your help. Please share logs and lets us know what you find out from your debugging.
This can be reproduce if you set a breakpoint in code after connecting to AppWarp. The problem is nothing is catching the exception in the AppWarp code. It should properly catch this condition and report a disconnect event instead of allowing the unhandled exception/crash to occur.
Can we get an update on this? With spotty internet this will crash the app due to this unhandled exception. It would be better to call the disconnect event handler when this occurs!
As this issue didn't reproduced on our side, what we can do now, is create a new build specially for you guys that has exception handling. Then you guys can log that exception and share with us. Once we found the root cause of this issue we will rectify it in our SDK. I will be soon attaching a new build on this thread.
Is there any ETA on this new build?

My original issue with the HTC EVO 4G LTE has gone away after I restarted the device but as jovan mentioned the exception can be reproduced on any device if you set a breakpoint somewhere in the code after connecting to AppWarp and wait a little bit while paused at the breakpoint. I believe the proper response from the AppWarp SDK should be handling the exception internally and then reporting a ConnectionErrorRecoverable event or a some other sort of ConnectionError if connection resiliency is not enabled.

If there is no error now then, I don't think creating a new build can be useful. I was going to add few extra exceptional handling to catch errors, but if they are not occurring now then it might not be much useful. Anyways in AppWarp SDK we have already handled connection and other issues. What happened in your case is a weird behavior as you yourself said it occurred only in HTC EVO LTE and that too disappeared after restarting.

Regarding what jovan.munroe said, we have used thread in SDK to run in background to collect data. When you put a break point, the main thread stops which results in crash. But this is not the case in real world scenarios as there are no break points.

Is there anyway you guys can at least make a build to stop that exception from being thrown when using breakpoints? I know that this will not happen when running the release versions of code but as a developer it is a real pain that I can't use a debugger to walk through my code without it crashing after a few seconds.
So would it be possible to just catch this exception in the AppWarp code and handle it as a connection issue? It is getting really frustrating when I am trying to debug and walkthrough another portion of my code not even related to AppWarp and then my app crashes because I lose connection to AppWarp and I get the KeepAliveTimer expired exception.
I have also noticed that on the latest build of AppWarp for Xamarin (found in one of the later responses on this page: ) if you try to disconnect it will throw a socket exception as well. If you guys could fix this bug I would really appreciate it.
hi. I have the same problem. Any updates on this?
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on