Tom Fin
Tom Fin

Reputation: 11

Firebase Remote Config ArgumentOutOfRangeException on iOS

On iOS, Firebase Remote Config is throwing an ArgumentOutOfRangeException:

Exception: ArgumentOutOfRangeException: Value to add was out of range.
  Parameter name: value
  System.DateTime.TimeToTicks (System.Int32 hour, System.Int32 minute, System.Int32 second) (at <00000000000000000000000000000000>:0)
  Rebar.GameData.RemoteConfigFetcher+<>c__DisplayClass20_0.<Refresh>b__1 () (at <00000000000000000000000000000000>:0)
  System.Threading.ContextCallback.Invoke (System.Object state) (at <00000000000000000000000000000000>:0)
  System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) (at <00000000000000000000000000000000>:0)
  System.Runtime.CompilerServices.AsyncMethodBuilderCore+MoveNextRunner.Run () (at <00000000000000000000000000000000>:0)
  System.Action.Invoke () (at <00000000000000000000000000000000>:0)
  System.Threading.ContextCallback.Invoke (System.Object state) (at <00000000000000000000000000000000>:0)
  System.Threading.Tasks.AwaitTaskContinuation.RunCallback (System.Threading.ContextCallback callback, System.Object state, System.Threading.Tasks.Task& currentTask) (at <00000000000000000000000000000000>:0)
  System.Threading.Tasks.Task.FinishContinuations () (at <00000000000000000000000000000000>:0)
  System.Threading.Tasks.Task`1[TResult].TrySetResult (TResult result) (at <00000000000000000000000000000000>:0)
  System.Threading.Tasks.TaskCompletionSource`1[TResult].TrySetResult (TResult result) (at <00000000000000000000000000000000>:0)
  System.Threading.Tasks.TaskCompletionSource`1[TResult].SetResult (TResult result) (at <00000000000000000000000000000000>:0)
  Firebase.FutureVoid+<GetTask>c__AnonStorey0.<>m__0 () (at <00000000000000000000000000000000>:0)
  Firebase.FutureVoid+Action.Invoke () (at <00000000000000000000000000000000>:0)
  Firebase.FutureVoid.SWIG_CompletionDispatcher (System.Int32 key) (at <00000000000000000000000000000000>:0)
  Firebase.AppUtil.PollCallbacks () (at <00000000000000000000000000000000>:0)
  Firebase.Platform.FirebaseHandler.Update () (at <00000000000000000000000000000000>:0)
  Rebar.GameData.<>c__DisplayClass20_0:<Refresh>b__1()
  System.Threading.Tasks.TaskCompletionSource`1:SetResult(TResult)
  Firebase.<GetTask>c__AnonStorey0:<>m__0()
  Firebase.Action:Invoke()
  Firebase.FutureVoid:SWIG_CompletionDispatcher(Int32)
  Firebase.AppUtil:PollCallbacks()
  Firebase.Platform.FirebaseHandler:Update()

I'm not sure where this error might be coming from or what could be causing it. It was working just the other day.

We are running Firebase 7.2.0 in Unity 2019.4.17f1. The problem appears to be iOS specific.

The relevant section of code:

private async Task<Dictionary<string, object> FetchAndActivateAsync(){
  _fetchState = FetchState.Fetching;
  await _remoteConfig.FetchAsync(TimeSpan.Zero);
  _fetchState = FetchState.Applying;
  if(_remoteConfig.Info.LastFetchStatus == LastFetchStatus.Failure){
    _fetchState = FetchState.Fail;
    return null;
  }
  await _remoteConfig.ActivateAsync();
  var configs = new Dictionary<string, object>();
  foreach(string key in _remoteConfig.Keys){
    var configValue = _remoteConfig.GetValue(key);
    AddConfig(key, configValue, configs); //just does some sorting and translating
  }
  _fetchState = FetchState.Success;
  return configs;
}

Upvotes: 0

Views: 247

Answers (1)

Tom Fin
Tom Fin

Reputation: 11

Appears to have actually been caused by a debug log accessing RemoteConfig.ConfigInfo.ThrottledEndTime when the request wasn't being throttled. Breaking up the log and checking LastFetchFailureReason first, seems to have fixed the issue.

Upvotes: 1

Related Questions