/// <summary> /// Create new default session with specified parameters /// </summary> /// <param name="appInsightsIKey"></param> /// <param name="asimovIKey"></param> /// <returns></returns> public static TelemetrySession CreateAndGetDefaultSession(string appInsightsIKey, string asimovIKey) { bool flag = true; if (InternalDefaultSession == null) { lock (lockDefaultSessionCreation) { if (InternalDefaultSession == null) { CodeContract.RequiresArgumentNotEmptyOrWhitespace(appInsightsIKey, "appInsightsIKey"); CodeContract.RequiresArgumentNotEmptyOrWhitespace(asimovIKey, "asimovIKey"); TelemetrySessionInitializer @default = TelemetrySessionInitializer.Default; @default.AppInsightsInstrumentationKey = appInsightsIKey; @default.AsimovInstrumentationKey = asimovIKey; InternalDefaultSession = TelemetrySession.Create(@default); flag = false; } } } if (flag) { throw new InvalidOperationException("Unable to create new default Telemetry Session with provided keys."); } return(InternalDefaultSession); }