Hi Guys,
Since using Async calls to web services I am now getting this exception every now and again happens about 10% of the time.
Literally performing the same operation: Launch App > Click on MasterDetailPage > Select Settings Page (Tabbed page with 2 pages).
There is a call which syncs the settings when the page loads.
VS breaks on the following line of code:
return DependencyService.Get<IWebServices>().CallProgFromWeb(parameterObj, encryptionKey);
With "System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary."
Both parameterObj and encryptionKey are ok.
IWebServices seems to appear under the property DependancyTypes, the only different to the others being the value "GlobalInstance" seems to be null under DependancyImplementions.
I have tried adding the line "DependencyService.Register();" into the App page with no luck.
public static string[] CallProg(string[] parameters, string programName)
{
var encryptionKey = WebServiceSecurity.GetEncryptionKey();
var parameterObj = WebServiceFunctions.ConvertArrayToObject(programName, parameters);
return DependencyService.Get<IWebServices>().CallProgFromWeb(parameterObj, encryptionKey);
}
using System;
using POD.iOS;
using XamarinSharedStandardProject.Interfaces;
using Xamarin.Forms;
using XamarinSharedStandardProject.Data;
[assembly: Dependency(typeof(WebServices))]
namespace POD.iOS
{
class WebServices : IWebServices
{
public WebServices()
{
.......
}
public bool ConnectionTest()
{
.......
}
public string[] CallProgFromWeb(Object[] parameters, string encryptionKey)
{
........
}
}
}
StackTrace:
at System.Collections.Generic.Dictionary`2[TKey,TValue].get_Item (TKey key) [0x0001e] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.6.1.2/src/mono/external/corert/src/System.Private.CoreLib/src/System/Collections/Generic/Dictionary.cs:223
at Xamarin.Forms.DependencyService.Get[T] (Xamarin.Forms.DependencyFetchTarget fetchTarget) [0x00041] in \agent_work\1\s\Xamarin.Forms.Core\DependencyService.cs:28
Any Ideas?