예제 #1
0
        public Task WaitForStartAsync(CancellationToken cancellationToken)
        {
            cancellationToken.ThrowIfCancellationRequested();

            _applicationStartedRegistration = _applicationLifetime.ApplicationStarted.Register(state =>
            {
                ((PluginsHostLifetime)state).OnApplicationStarted();
            }, this);

            AppDomain.CurrentDomain.ProcessExit += OnProcessExit;

#if !DEBUG
            try
#endif
            {
                _applicationContext.Initialize();
                return(Task.CompletedTask);
            }
#if !DEBUG
            catch (Exception ex)
            {
                _logger.LogError(ex, $"The {_applicationContext.Name} application failed to initialize.");
                throw;
            }
#endif
        }