Skip to content

Commit

Permalink
Ensure Session Manager is created before we decide what to do with pe…
Browse files Browse the repository at this point in the history
…nding requests to avoid potential nullref.
  • Loading branch information
damieng committed Feb 10, 2015
1 parent 05db256 commit 271a943
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions NuGet/CSharpAnalytics.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package >
<metadata>
<id>CSharpAnalytics</id>
<version>1.2.0</version>
<version>1.2.1</version>
<authors>Damien Guard</authors>
<owners>Attack Pattern</owners>
<licenseUrl>https://raw.github.com/AttackPattern/CSharpAnalytics/master/Source/LICENCE.txt</licenseUrl>
Expand All @@ -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)
</releaseNotes>
<copyright>Copyright 2012-2014 Attack Pattern LLC</copyright>
<copyright>Copyright 2012-2015 Attack Pattern LLC</copyright>
<tags>google analytics, metrics, analytics, ga, measurement protocol</tags>
</metadata>
<files>
Expand Down
5 changes: 3 additions & 2 deletions Source/CSharpAnalytics/AutoMeasurement/BaseAutoMeasurement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<SessionState>(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);

Expand Down

0 comments on commit 271a943

Please sign in to comment.