Skip to content

[Remote Config] Add EnsureInitialized automated test and make ConfigInfo.UnixEpochUtc static readonly - #1581

Open
AustinBenoit wants to merge 3 commits into
mainfrom
fix/remote-config-configinfo-clamp
Open

AustinBenoit wants to merge 3 commits into
mainfrom
fix/remote-config-configinfo-clamp

Conversation

@AustinBenoit

@AustinBenoit AustinBenoit commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Description

Paired with firebase/firebase-cpp-sdk#1998 (which fixes firebase/firebase-cpp-sdk#1997 and the underlying Android root cause of #1481).

Summary of changes:

  • remote_config/testapp/Assets/Firebase/Sample/RemoteConfig/UIHandlerAutomated.cs: Added TestEnsureInitialized verifying that both EnsureInitializedAsync() and Info return non-null ConfigInfo instances with DateTimeKind.Utc timestamps.
  • remote_config/src/ConfigInfo.cs: Made UnixEpochUtc static readonly (matching StorageMetadata, AppCheckToken, UserMetadata, and IdTokenResult).

Testing

  • Built firebase_remote_config_cs (Firebase.RemoteConfig.dll) against the paired C++ PR branch: 0 SWIGTYPE_p_ leaks, 0 compiler warnings.
  • Compiled UIHandler.cs, UIHandlerAutomated.cs, and AutomatedTestRunner.cs against the built Firebase.RemoteConfig.dll: 0 errors, 0 warnings.

Type of Change

Place an x in the applicable box:

…MaxValue (UTC)

Paired with firebase/firebase-cpp-sdk#1997 (and #1481).

- Replace UnixEpochUtc.AddMilliseconds(ulong) in ConfigInfo.cs with tick-exact FromUnixEpochMilliseconds(ulong) clamping to DateTime.MaxValue (UTC), preventing ArgumentOutOfRangeException and double rounding overflow at the DateTime.MaxValue boundary.
- Add TestEnsureInitialized to Remote Config UIHandlerAutomated.cs verifying EnsureInitializedAsync() and Info return non-null UTC timestamps.
- Add release note under ### Upcoming Release in docs/readme.md.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request prevents ArgumentOutOfRangeException on out-of-range timestamps by clamping ConfigInfo.FetchTime and ConfigInfo.ThrottledEndTime to DateTime.MaxValue (UTC). It also adds an automated test to verify that these properties are correctly initialized with UTC kind. The feedback suggests adding a defensive null check for configInfoInternal in the ConfigInfo constructor to prevent a potential NullReferenceException.

Comment thread remote_config/src/ConfigInfo.cs Resolved
Match the repository's existing UnixEpochUtc.AddMilliseconds convention
(StorageMetadata, AppCheckToken, UserMetadata) while keeping the
MaxUnixEpochMilliseconds -> MaxDateTimeUtc guard. Every integer in
[0, 253402300799999] is exact in IEEE-754 double (< 2^53).
…st and static readonly UnixEpochUtc

Let firebase/firebase-cpp-sdk#1998 fix the underlying Android uninitialized
ConfigInfo::throttled_end_time bug at the root rather than clamping in C#,
keeping ConfigInfo consistent with StorageMetadata, AppCheckToken,
UserMetadata, and IdTokenResult.
@AustinBenoit AustinBenoit changed the title [Remote Config] Clamp out-of-range ConfigInfo timestamps to DateTime.MaxValue (UTC) [Remote Config] Add EnsureInitialized automated test and make ConfigInfo.UnixEpochUtc static readonly Nov 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

throttled_end_time in ConfigInfo uninitialized

1 participant