From 271a94399af71a9997da558c357e939819673504 Mon Sep 17 00:00:00 2001 From: Damien Guard Date: Mon, 9 Feb 2015 18:54:12 -0800 Subject: [PATCH] Ensure Session Manager is created before we decide what to do with pending requests to avoid potential nullref. --- NuGet/CSharpAnalytics.nuspec | 4 ++-- .../CSharpAnalytics/AutoMeasurement/BaseAutoMeasurement.cs | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/NuGet/CSharpAnalytics.nuspec b/NuGet/CSharpAnalytics.nuspec index 6a752e0..e2b1dc0 100644 --- a/NuGet/CSharpAnalytics.nuspec +++ b/NuGet/CSharpAnalytics.nuspec @@ -2,7 +2,7 @@ CSharpAnalytics - 1.2.0 + 1.2.1 Damien Guard Attack Pattern https://raw.github.com/AttackPattern/CSharpAnalytics/master/Source/LICENCE.txt @@ -14,7 +14,7 @@ Detect Windows OS version in store apps even on machines with a custom HAL Save session id and session number at startup to avoid loss should the app crash Custom metrics and dimensions can now be set on a specific activity (recommended) - Copyright 2012-2014 Attack Pattern LLC + Copyright 2012-2015 Attack Pattern LLC google analytics, metrics, analytics, ga, measurement protocol diff --git a/Source/CSharpAnalytics/AutoMeasurement/BaseAutoMeasurement.cs b/Source/CSharpAnalytics/AutoMeasurement/BaseAutoMeasurement.cs index 2be39db..ea0aa7e 100644 --- a/Source/CSharpAnalytics/AutoMeasurement/BaseAutoMeasurement.cs +++ b/Source/CSharpAnalytics/AutoMeasurement/BaseAutoMeasurement.cs @@ -64,11 +64,12 @@ public async void Start(MeasurementConfiguration configuration, string launchKin { isStarted = true; lastUploadInterval = uploadInterval ?? TimeSpan.FromSeconds(5); - await StartRequesterAsync(); var sessionState = await Load(SessionStorageName); sessionManager = new SessionManager(sessionState, configuration.SampleRate); - if (delayedOptOut != null) SetOptOut(delayedOptOut.Value); + await StartRequesterAsync(); + + if (delayedOptOut != null) SetOptOut(delayedOptOut.Value); Client.Configure(configuration, sessionManager, GetEnvironment(), Add);