/// <summary> /// This is the main entry point for your service instance. /// </summary> /// <param name="cancellationToken">Canceled when Service Fabric needs to shut down this service instance.</param> protected override async Task RunAsync(CancellationToken cancellationToken) { Guid traceId = Guid.NewGuid(); using (var healthReporter = new HealthReporter(traceId, this.logger, ComponentName, this.healthReporterId, this.HealthReportCallback, this.Context, HealthReporter.ReportTypes.Instance, this.configurationProvider.Config.HealthReportInterval)) { await healthReporter.StartAsync(traceId, cancellationToken).ConfigureAwait(false); this.logger.RunAsyncInvoked(traceId, ComponentName, this.GetType().FullName); while (!cancellationToken.IsCancellationRequested && !this.unsupportedConfigurationChangeOccurred) { await Task.Delay(250, cancellationToken).ConfigureAwait(false); } await healthReporter.StopAsync(traceId, cancellationToken).ConfigureAwait(false); } this.logger.Informational(traceId, ComponentName, "RunAsync completed."); }