Uh oh!
There was an error while loading. Please reload this page.
+semver:minor Made it possible to disable and enable tracking on the fly - #42
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
| public static void FlushClient() | ||
| { | ||
| s_singleton.Client.Flush(); | ||
| s_singleton._client.Flush(); |
There was a problem hiding this comment.
🚩 FlushClient and Statistics don't guard against uninitialized client
FlushClient() (Analytics.cs:1079) and the Statistics property (Analytics.cs:1022) access _client without checking AllowTracking. For SegmentClient, Flush() calls _analytics.Flush() directly (SegmentClient.cs:67) — if Initialize was never called (tracking disabled), _analytics is null and this throws NullReferenceException. Statistics happens to be safe because it reads from the static StatMonitor. This is a pre-existing issue, but the new ability to toggle tracking makes it easier to encounter: a caller might reasonably call FlushClient() without realizing the client was never initialized.
Was this helpful? React with 👍 or 👎 to provide feedback.
tombogle
left a comment
There was a problem hiding this comment.
@tombogle resolved 1 discussion.
Reviewable status: 0 of 5 files reviewed, all discussions resolved (waiting on andrew-polk and nabalone).
andrew-polk
left a comment
There was a problem hiding this comment.
@andrew-polk reviewed 5 files and all commit messages, and made 1 comment.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on nabalone and tombogle).
src/DesktopAnalytics/Analytics.cs line 275 at r3 (raw file):
s_locationInfo =newJsonObject(); UpdateServerInformationOnThisUser(true);
This is more of a preference thing, but I think it is helpful to do UpdateServerInformationOnThisUser(initializing: true);
Uh oh!
There was an error while loading. Please reload this page.
This change is