internal Telimena(ITelimenaStartupInfo startupInfo) { try { this.SetConnectionSecurityProtocol(); this.propertiesInternal = new TelimenaProperties(startupInfo); this.Locator = new Locator(this.Properties.StaticProgramInfo); this.telemetryModule = new TelemetryModule(this.Properties); this.updates = new UpdatesModule(this); this.httpClient = new TelimenaHttpClient(new HttpClient { BaseAddress = this.propertiesInternal.StartupInfo.TelemetryApiBaseUrl }); this.Messenger = new Messenger(this.Serializer, this.httpClient); ((TelemetryModule)this.telemetryModule).InitializeTelemetryClient(); if (startupInfo.RegisterUnhandledExceptionsTracking) { AppDomain.CurrentDomain.UnhandledException += this.CurrentDomain_UnhandledException; } } catch (Exception e) { TelemetryDebugWriter.WriteLine($"Error while initializing {nameof(Telimena)}. Error: {e}"); //above all, we don't want to throw errors in client apps. //No telemetry is better than boom. throw; } }
public static ITelimena Construct(ITelimenaStartupInfo startupInfo) { try { Telimena instance = new Telimena(startupInfo); return(instance); } catch { return(GetNullObjectTeli(startupInfo)); } }
/// <summary> /// Creates new instance /// </summary> /// <param name="info"></param> public TelimenaProperties(ITelimenaStartupInfo info) { this.StartupInfo = info; this.StaticProgramInfo = info.ProgramInfo ?? new ProgramInfo { PrimaryAssembly = new Model.AssemblyInfo(this.StartupInfo.MainAssembly), Name = this.StartupInfo.MainAssembly.GetName().Name }; this.UserInfo = info.UserInfo ?? new UserInfo { UserIdentifier = Environment.UserName, MachineName = Environment.MachineName }; this.SuppressAllErrors = info.SuppressAllErrors; this.TelimenaVersion = TelimenaVersionReader.ReadToolkitVersion(Assembly.GetExecutingAssembly()); }
/// <summary> /// Creates new instance /// </summary> /// <param name="info"></param> public TelimenaProperties(ITelimenaStartupInfo info) { this.StartupInfo = info; this.StaticProgramInfo = info.ProgramInfo ?? new ProgramInfo { PrimaryAssembly = new Model.AssemblyInfo(this.StartupInfo.MainAssembly), Name = this.StartupInfo.MainAssembly.GetName().Name }; this.Locator = new Locator(this.StaticProgramInfo); this.SuppressAllErrors = info.SuppressAllErrors; this.TelimenaVersion = TelimenaVersionReader.ReadToolkitVersion(Assembly.GetExecutingAssembly()); this.InstrumentationKey = this.StartupInfo.InstrumentationKey; }
internal static ITelimena GetNullObjectTeli(ITelimenaStartupInfo startupInfo) { //something went wrong when building telimena //return something that will not break client's code ITelimenaProperties props; try { //try at least building properties if possible props = new TelimenaProperties(startupInfo); } catch { //ok, even that failed, return fail safe thing props = new NullObjectTelimenaProperties(); } return(new NullObjectTelimena(props)); }
public static ITelimena Construct(ITelimenaStartupInfo startupInfo) { try { if (startupInfo.TelemetryApiBaseUrl != null) { Telimena instance = new Telimena(startupInfo); return(instance); } else { throw new TelimenaException("Error - Telimena URL is not specified. Telimena will not work. See logs for details."); } } catch { return(GetNullObjectTeli(startupInfo)); } }
public static ITelimena Construct(ITelimenaStartupInfo startupInfo) { return(TelimenaFactory.Construct(startupInfo)); }