I develop native Windows 10 client LOB apps for a customer.
The environment: Windows 10 Pro (on the mobile clients / tablets and on the developer box), Visual Studio 2015 Professional with Update 3, all updates and patches installed. The client app uses the most recent „IBM MobileFirst Platform SDK for Windows 8 Universal and Windows 10 Universal platforms“ version 8.0.2017012514. On a separate machine in my network I have the MobileFirst Platform Server with a Java Adapter.
The application works very well when the application is online and the MobileFirst Platform 8.0 server can be reached.
If the client looses its network connectivity (e.g. WLAN out of reach or MFP Server offline), then all Requests to the Server hang indefinitely. See the following sample C# code:
public async Task CallMethodMfp8()
{
Value = "Start MobileFirst Method Call " + DateTime.Now + "\n" + Value;
StringBuilder uriBuilder = new StringBuilder().Append("/adapters")
.Append("/MaximoAdapter")
.Append("/admin")
.Append("/heartbeat");
WorklightResourceRequest rr = _client.ResourceRequest(new
Uri(uriBuilder.ToString(), UriKind.Relative), "GET", "");
rr.Timeout = 500;
WorklightResponse resp = await rr.Send();
if (!resp.Success)
{
Value = "NOT SUCCESSFULL " + resp.Message + "\n" + Value;
}
else
{
Value = "Request OK" + resp.ResponseText + "\n" + Value;
}
Value = "Method Call Finished " + DateTime.Now + "\n" + Value;
}
The call to rr.Send() does not return if the device is offline. Also the Timeout parameter seems to have no effect (according to the docs this should be the timeout in Milliseconds).
This behaviour has a negative impact on the usability of the client application.
From reading the docs I would expect that the call returns after the configured timeout and that the resp.Success field is false.
I assume that the call to WorklightResourceRequest.Send() is not supposed to hang when offline and that this is a bug in the MobileFirst Platform library.
Is there a workaround for this or am I using the library incorrectly?