Plugin.Geolocator.Abstractions.IGeolocator.GetPositionAsync IndexOutOfRangeException

0

I'm using Xamarin.Forms and trying to get the position with the Plugin.Geolocator and GetPositionAsync method drops in an IndexOutOfRangeException

        var locator = CrossGeolocator.Current;

        CancellationToken cancellation = new CancellationToken(false);

        locator.DesiredAccuracy = 1;

        if (!CrossGeolocator.IsSupported)
            position = new Position();
        if (!CrossGeolocator.Current.IsGeolocationEnabled)
            position = new Position();
        if (!CrossGeolocator.Current.IsGeolocationAvailable)
            position = new Position();

        try
        {
            position = await locator.GetPositionAsync(TimeSpan.FromTicks(1), cancellation, true);
        }
        catch (Exception e)
        {
            position = new Position();
        }


System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.IndexOutOfRangeException: Index was outside the bounds of the array.
  at (wrapper stelemref) System.Object.virt_stelemref_object(intptr,object)
  at <StartupCode$NInterpret-Xamarin-Droid>.$Interpreter.push@3149 (NInterpret.Interpreter this, System.Collections.Generic.Stack'1[T] callStack, System.Object x) [0x00028] in <5b4cad727eef0f2aa745038372ad4c5b>:0 
  at NInterpret.Interpreter.interpretBlock (System.Object[] args, System.Object[] locals, Mono.Cecil.Cil.Instruction initialInstruction, Microsoft.FSharp.Collections.FSharpSet'1[T] inTries, Microsoft.FSharp.Core.FSharpOption'1[T] lastException) [0x00225] in <5b4cad727eef0f2aa745038372ad4c5b>:0 
  at NInterpret.Interpreter.interpret (System.Object[] args) [0x00098] in <5b4cad727eef0f2aa745038372ad4c5b>:0 
  at NInterpret.Interpreter.callAMethod (NInterpret.AMethod m, NInterpret.AType[] ptypes, NInterpret.AType[] genericMethodArgs, System.Collections.Generic.Dictionary'2[TKey,TValue] genericArgsIndex, System.Object[] args, System.Collections.Generic.List'1[T] byRefArgs, Microsoft.FSharp.Core.FSharpOption'1[T] byRefTarget, System.Object target, System.Boolean virtualCall) [0x00183] in <5b4cad727eef0f2aa745038372ad4c5b>:0 

Hugs and Kisses

    
asked by anonymous 16.08.2018 / 21:59

0 answers