private void InitializeSession() { if (!isInitialized) { lock (initializedLock) { if (!isInitialized && isManifestCompleted && isMACAddressCompleted && isHardwareIdCompleted) { List <KeyValuePair <string, object> > list = persistentPropertyBag.GetAllProperties().ToList(); list.Add(new KeyValuePair <string, object>("VS.Core.Session.IsCloned", isSessionCloned)); list.Add(new KeyValuePair <string, object>("VS.TelemetryApi.Session.IsShort", startedDisposing)); list.Add(new KeyValuePair <string, object>("VS.TelemetryApi.Session.ForcedReadManifest", ManifestManager.ForcedReadManifest)); list.Add(new KeyValuePair <string, object>("VS.TelemetryApi.DefaultChannels", StringExtensions.Join((IEnumerable <string>)defaultSessionChannelsId, ","))); diagnosticTelemetry.PostDiagnosticTelemetryWhenSessionInitialized(this, list); persistentPropertyBag.Clear(); TelemetryEvent telemetryEvent; while (telemetryBufferChannel.TryDequeue(out telemetryEvent)) { defaultContext.ProcessEvent(telemetryEvent); PostProcessedEvent(telemetryEvent); } isInitialized = true; while (telemetryBufferChannel.TryDequeue(out telemetryEvent)) { defaultContext.ProcessEvent(telemetryEvent, false); PostProcessedEvent(telemetryEvent); } telemetryBufferChannel = null; identityTelemetry.IdentityInformationProvider.SchedulePostPersistedSharedPropertyAndSendAnyFaults(this, contextScheduler ?? new TelemetryScheduler()); identityTelemetry.PostIdentityTelemetryWhenSessionInitialized(this); } } } }
public void AddSharedProperties(List <KeyValuePair <string, object> > sharedProperties, TelemetryContext telemetryContext) { IEnumerable <KeyValuePair <string, object> > allProperties = persistedSessionProperties.GetAllProperties(); sharedProperties.AddRange(allProperties); }