public RulesVerifier(string?rulePath, Logger?logger, bool failFast = true)
 {
     _logger    = logger;
     _rulesPath = rulePath;
     _failFast  = failFast;
     _rules     = new RuleSet(_logger);
 }
 public RabbitQueueService(ConfigService.ConfigService configService, ConnectionFactory connectionFactory, Logger?logger = null, CancellationTokenSource?cancellationTokenSource = null)
 {
     this.configService           = configService;
     this.connectionFactory       = connectionFactory;
     this.logger                  = logger;
     this.cancellationTokenSource = cancellationTokenSource;
 }
示例#3
0
        public static void Run(string[] args, Logger?logger = null)
        {
            ValidateResources();

            Log.Logger = logger ?? new LoggerConfiguration()
                         .Enrich.FromLogContext()
                         .MinimumLevel.Debug()
                         .MinimumLevel.Override("Microsoft", LogEventLevel.Warning)
                         .WriteTo.ColoredConsole()
                         .CreateLogger();



            try
            {
                Log.Information("Starting ServiceBlock");
                CreateHostBuilder(args).Build().Run();
            }
            catch (Exception ex)
            {
                Log.Fatal(ex, "ServiceBlock terminated unexpectedly");
            }
            finally
            {
                Log.CloseAndFlush();
            }
        }
 public KafkaQueueService(ConfigService.ConfigService configService, ConsumerConfig consumerConfig, Logger?logger = null, CancellationTokenSource?cancellationTokenSource = null)
 {
     this.configService           = configService;
     this.consumerConfig          = consumerConfig;
     this.logger                  = logger;
     this.cancellationTokenSource = cancellationTokenSource;
 }
示例#5
0
        public override void OnFrameworkInitializationCompleted()
        {
            if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
            {
                AppDomain.CurrentDomain.UnhandledException += OnAppDomainUnhandledException;

                try
                {
                    QuestPatcherService questPatcherService = new QuestPatcherUIService(desktop);
                    _logger = questPatcherService.Logger;

                    desktop.Exit += (_, _) =>
                    {
                        questPatcherService.CleanUp();
                    };
                }
                catch (Exception ex)
                {
                    DialogBuilder dialog = new()
                    {
                        Title            = "Critical Error",
                        Text             = "QuestPatcher encountered a critical error during early startup, which was unrecoverable.",
                        HideCancelButton = true
                    };
                    dialog.WithException(ex);
                    dialog.OpenDialogue(null, WindowStartupLocation.CenterScreen);
                }
            }
            base.OnFrameworkInitializationCompleted();
        }
    }
示例#6
0
    static Compiler CreateCompiler(Logger?logger, string projectDir, Platform platform)
    {
        logger?.Append("Create Compiler");

        {
            var compilerDirectory = Path.Combine(projectDir, ROSLYN_DIR, "net472");
            if (File.Exists(Path.Combine(compilerDirectory, RoslynCompiler.ExeName)))
            {
                logger?.Append("Compiler directory: " + compilerDirectory);
                return(new RoslynCompiler(logger, compilerDirectory));
            }
        }

        {
            var compilerDirectory = Path.Combine(projectDir, ROSLYN_DIR, "netcoreapp3.1");
            if (File.Exists(Path.Combine(compilerDirectory, DotnetRoslynCompiler.ExeName)))
            {
                logger?.Append("Compiler directory: " + compilerDirectory);
                return(new DotnetRoslynCompiler(logger, compilerDirectory));
            }
        }

        {
            var compilerDirectory = Path.Combine(projectDir, INCREMENTAL_COMPILER_DIR);
            logger?.Append("Compiler directory: " + compilerDirectory);
            return(new IncrementalCompiler(logger, compilerDirectory));
        }
    }
示例#7
0
 private Logger(string tag, SharedContext ctx, Logger?forward_log)
 {
     m_ctx      = null !;
     Tag        = tag;
     Context    = ctx;
     ForwardLog = forward_log;
     Enabled    = true;
 }
示例#8
0
        /// <summary>
        /// Registers the <see cref="ExecutionContext"/> <see cref="Logger"/> instance (accessible via <see cref="Logger"/> <see cref="Logger.Default"/>).
        /// </summary>
        /// <param name="binder">The action that binds the logger to an underlying logging capability.</param>
        public void RegisterLogger(Action <LoggerArgs> binder)
        {
            if (Logger != null)
            {
                throw new InvalidOperationException("A RegisterLogger has already been performed for the current ExecutionContext instance.");
            }

            Logger = new Logger(binder ?? throw new ArgumentNullException(nameof(binder)));
        }
示例#9
0
        protected static void CompareFiles(string inputFileName, string outputFileName, ProcessorOptions options,
                                           Logger?logger = null)
        {
            var    processor = new Processor(options, logger ?? new Logger());
            string actual    = processor.Process(ReadFileFromResources(inputFileName));
            string expected  = ReadFileFromResources(outputFileName).Data;

            Assert.Equal(expected, actual);
        }
示例#10
0
        public LogService()
        {
            // Custom configuration support
            var installDir = new FileInfo(Process.GetCurrentProcess().MainModule.FileName).DirectoryName;

            _configurationPath = Path.Combine(installDir, "serilog.json");
#if DEBUG
            var initialLevel = LogEventLevel.Debug;
#else
            var initialLevel = LogEventLevel.Information;
#endif
            _levelSwitch = new LoggingLevelSwitch(initialMinimumLevel: initialLevel);
            try
            {
                _screenLogger = new LoggerConfiguration()
                                .MinimumLevel.ControlledBy(_levelSwitch)
                                .Enrich.FromLogContext()
                                .Filter.ByIncludingOnly(x => { Dirty = true; return(true); })
                                .WriteTo.Console(outputTemplate: " {Message:l}{NewLine}", theme: AnsiConsoleTheme.Code)
                                .CreateLogger();
                _debugScreenLogger = new LoggerConfiguration()
                                     .MinimumLevel.ControlledBy(_levelSwitch)
                                     .Enrich.FromLogContext()
                                     .Filter.ByIncludingOnly(x => { Dirty = true; return(true); })
                                     .WriteTo.Console(outputTemplate: " [{Level:u4}] {Message:l}{NewLine}{Exception}", theme: AnsiConsoleTheme.Code)
                                     .CreateLogger();
            }
            catch (Exception ex)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine($" Error creating screen logger: {ex.Message} - {ex.StackTrace}");
                Console.ResetColor();
                Console.WriteLine();
                Environment.Exit(ex.HResult);
            }

            try
            {
                var _eventConfig = new ConfigurationBuilder()
                                   .AddJsonFile(_configurationPath, true, true)
                                   .Build();

                _eventLogger = new LoggerConfiguration()
                               .MinimumLevel.ControlledBy(_levelSwitch)
                               .Enrich.FromLogContext()
                               .WriteTo.EventLog("win-acme", manageEventSource: true)
                               .ReadFrom.Configuration(_eventConfig, "event")
                               .CreateLogger();
            }
            catch (Exception ex)
            {
                Warning("Error creating event logger: {ex}", ex.Message);
            }
            Log.Debug("The global logger has been configured");
        }
示例#11
0
        public void Init(Logger log, Config.Config config, Zenjector zenject)
        {
            Logger = log;
            ModListConfig.Instance ??= config.Generated <ModListConfig>();

            zenject.UseLogger(log);
            zenject.UseMetadataBinder <Plugin>();

            zenject.Install <MLAppInstaller>(Location.App, ModListConfig.Instance);
            zenject.Install <MLMenuInstaller>(Location.Menu);
        }
示例#12
0
 public App(
     IQueueService queueService,
     KafkaMediator kafkaMediator,
     RabbitMediator rabbitMediator,
     Logger?logger = null
     )
 {
     this.queueService   = queueService;
     this.kafkaMediator  = kafkaMediator;
     this.rabbitMediator = rabbitMediator;
     this.logger         = logger;
 }
示例#13
0
        public BrokerRConnection(string url, Dictionary <string, RequestHandler> handlers, Logger?logger)
        {
            var retryPolicy = new EternalRetryPolicy(logger);

            _connection = new HubConnectionBuilder()
                          .WithUrl(url)
                          .WithAutomaticReconnect(retryPolicy)
                          .Build();

            _handlers = handlers;
            _logger   = logger;
        }
示例#14
0
 public void Run(Logger?logger)
 {
     logger?.Info("First measuring");
     Measure();
     logger?.Info("First arranging");
     Arrange();
     logger?.Info("Interlude");
     Interlude();
     logger?.Info("Second measuring");
     Measure();
     logger?.Info("Second arranging");
     Arrange();
 }
        /// <summary>
        /// Common method of retrieving rules from AppInspector.Commands manifest
        /// </summary>
        /// <param name="logger"></param>
        /// <returns></returns>
        public static RuleSet GetDefaultRuleSet(Logger?logger = null)
        {
            RuleSet  ruleSet  = new(logger);
            Assembly assembly = Assembly.GetExecutingAssembly();
            string   filePath = "Microsoft.ApplicationInspector.Commands.defaultRulesPkd.json";
            Stream?  resource = assembly.GetManifestResourceStream(filePath);

            using (StreamReader file = new(resource ?? new MemoryStream()))
            {
                ruleSet.AddString(file.ReadToEnd(), filePath, null);
            }

            return(ruleSet);
        }
示例#16
0
        public void SetDiskLoggingPath(string path)
        {
            try
            {
                var defaultPath                   = path.TrimEnd('\\', '/') + "\\log-.txt";
                var defaultRollingInterval        = RollingInterval.Day;
                var defaultRetainedFileCountLimit = 120;
                var fileConfig = new ConfigurationBuilder()
                                 .AddJsonFile(_configurationPath, true, true)
                                 .Build();

                foreach (var writeTo in fileConfig.GetSection("disk:WriteTo").GetChildren())
                {
                    if (writeTo.GetValue <string>("Name") == "File")
                    {
                        var pathSection = writeTo.GetSection("Args:path");
                        if (string.IsNullOrEmpty(pathSection.Value))
                        {
                            pathSection.Value = defaultPath;
                        }
                        var retainedFileCountLimit = writeTo.GetSection("Args:retainedFileCountLimit");
                        if (string.IsNullOrEmpty(retainedFileCountLimit.Value))
                        {
                            retainedFileCountLimit.Value = defaultRetainedFileCountLimit.ToString();
                        }
                        var rollingInterval = writeTo.GetSection("Args:rollingInterval");
                        if (string.IsNullOrEmpty(rollingInterval.Value))
                        {
                            rollingInterval.Value = ((int)defaultRollingInterval).ToString();
                        }
                    }
                }

                _diskLogger = new LoggerConfiguration()
                              .MinimumLevel.ControlledBy(_levelSwitch)
                              .Enrich.FromLogContext()
                              .Enrich.WithProperty("ProcessId", Process.GetCurrentProcess().Id)
                              .WriteTo.File(
                    defaultPath,
                    rollingInterval: defaultRollingInterval,
                    retainedFileCountLimit: defaultRetainedFileCountLimit)
                              .ReadFrom.Configuration(fileConfig, "disk")
                              .CreateLogger();
            }
            catch (Exception ex)
            {
                Warning("Error creating disk logger: {ex}", ex.Message);
            }
        }
        public LoggerLogRoute(string kind, LogPriority minimalPriority, string prefix, string dir, LogSwitchType switchType, LogInfoOptions infoOptions,
                              long?autoDeleteTotalMaxSize = null) : base(kind, minimalPriority)
        {
            if (minimalPriority == LogPriority.None)
            {
                return;
            }

            Log = new Logger(dir, kind, prefix, LocalLogRouter.UniqueLogProcessId,
                             switchType: switchType,
                             infoOptions: infoOptions,
                             maxLogSize: CoresConfig.Logger.DefaultMaxLogSize,
                             autoDeleteTotalMinSize: autoDeleteTotalMaxSize ?? CoresConfig.Logger.DefaultAutoDeleteTotalMinSize);

            AddDirectDisposeLink(Log);
        }
示例#18
0
 public void SetDiskLoggingPath(string path)
 {
     try
     {
         _diskLogger = new LoggerConfiguration()
                       .MinimumLevel.ControlledBy(_levelSwitch)
                       .Enrich.FromLogContext()
                       .WriteTo.File(path.TrimEnd('\\', '/') + "\\log-.txt", rollingInterval: RollingInterval.Day)
                       .ReadFrom.Configuration(ConfigurationRoot, "disk")
                       .CreateLogger();
     }
     catch (Exception ex)
     {
         Warning("Error creating disk logger: {ex}", ex.Message);
     }
 }
示例#19
0
        public bool SetLogLevel(string name, int newLeveli, bool isLogger = true)
        {
            if (newLeveli < 0)
            {
                return(false);
            }

            LogLevel newLevel = (LogLevel)newLeveli;

            if (isLogger)
            {
                Logger?search = null;
                foreach (var pair in _loggers)
                {
                    if (pair.Value.Name == name)
                    {
                        search = pair.Value;
                        break;
                    }
                }

                if (search == null)
                {
                    return(false);
                }

                search.LogLevel = newLevel;

                if (newLevel != LOG_LEVEL_DISABLED && newLevel < _lowestLogLevel)
                {
                    _lowestLogLevel = newLevel;
                }
            }
            else
            {
                Appender?appender = GetAppenderByName(name);
                if (appender == null)
                {
                    return(false);
                }

                appender.LogLevel = newLevel;
            }

            return(true);
        }
示例#20
0
            public Test.RemoteCommunicatorPrx createCommunicator(Dictionary <string, string> props, Ice.Current current)
            {
                //
                // Prepare the property set using the given properties.
                //
                Logger?logger = null;
                string?value;
                int    nullLogger;

                if (props.TryGetValue("NullLogger", out value) && int.TryParse(value, out nullLogger) && nullLogger > 0)
                {
                    logger = new NullLogger();
                }

                //
                // Initialize a new communicator.
                //
                var communicator = new Communicator(props, logger: logger);

                //
                // Install a custom admin facet.
                //
                try
                {
                    communicator.AddAdminFacet <TestFacet, TestFacetTraits>(new TestFacetI(), "TestFacet");
                }
                catch (System.ArgumentException ex)
                {
                }

                //
                // The RemoteCommunicator servant also implements PropertiesAdminUpdateCallback.
                // Set the callback on the admin facet.
                //
                RemoteCommunicatorI servant = new RemoteCommunicatorI(communicator);
                var propFacet = communicator.FindAdminFacet("Properties").servant;

                if (propFacet != null)
                {
                    Ice.NativePropertiesAdmin admin = (Ice.NativePropertiesAdmin)propFacet;
                    Debug.Assert(admin != null);
                    admin.addUpdateCallback(servant.updated);
                }

                return(current.Adapter.Add(servant));
            }
示例#21
0
        private void InitLogger()
        {
            var config = new LoggingConfiguration();

            var logfile = new FileTarget("logfile")
            {
                FileName     = Path.Combine(FileSystem.CacheDirectory, AppConstants.LogFileName),
                AutoFlush    = true,
                ArchiveEvery = FileArchivePeriod.Month
            };
            var debugTarget = new DebugTarget("console");

            config.AddRule(LogLevel.Info, LogLevel.Fatal, debugTarget);
            config.AddRule(LogLevel.Debug, LogLevel.Fatal, logfile);

            LogManager.Configuration = config;
            logManager = LogManager.GetCurrentClassLogger();
        }
示例#22
0
        /// <summary>
        /// Creates instance of RuleProcessor
        /// </summary>
        public RuleProcessor(RuleSet rules, Confidence confidenceFilter, Logger?logger, bool uniqueMatches = false, bool stopAfterFirstMatch = false)
        {
            _ruleset                = rules;
            EnableCache             = true;
            _uniqueTagHashes        = new ConcurrentDictionary <string, byte>();
            _rulesCache             = new ConcurrentDictionary <string, IEnumerable <ConvertedOatRule> >();
            _runningResultsList     = new List <MatchRecord>();
            _controllRunningListAdd = new object();
            _stopAfterFirstMatch    = stopAfterFirstMatch;
            _uniqueTagMatchesOnly   = uniqueMatches;
            _logger = logger;
            ConfidenceLevelFilter = confidenceFilter;
            SeverityLevel         = Severity.Critical | Severity.Important | Severity.Moderate | Severity.BestPractice; //finds all; arg not currently supported

            analyzer = new Analyzer();
            analyzer.SetOperation(new WithinOperation(analyzer));
            analyzer.SetOperation(new OATRegexWithIndexOperation(analyzer)); //CHECK with OAT team as delegate doesn't appear to fire; ALT working fine in Analyze method anyway
        }
示例#23
0
        private static async Task Main(string[] args)
        {
            try
            {
                Program.config = new ConfigService();
                Startup.Configure(Program.config);

                Program.services = new ServiceCollection();
                Program.services.AddSingleton <ConfigService>(Program.config);

                Program.services.AddSingleton <App>();
                Startup.ConfigureServices(Program.services, Program.config);

                Program.provider = Program.services.BuildServiceProvider();

                Program.app          = provider.GetRequiredService <App>();
                Program.logger       = provider.GetService <Logger>();
                Program.cancellation = provider.GetService <CancellationTokenSource>();

                Console.CancelKeyPress += (_, eventArgs) =>
                {
                    eventArgs.Cancel = true;
                    Program.cancellation?.Cancel();
                };

                await Program.app.RunAsync();

                await TaskExtension.Delay(-1, Program.cancellation);
            }
            catch (TaskCanceledException ex)
            {
                Program.Out(LogEventLevel.Debug, ex.Message);
            }
            catch (Exception ex)
            {
                Program.Out(LogEventLevel.Fatal, ex);
            }
            finally
            {
                Log.CloseAndFlush();
            }

            Program.Out(LogEventLevel.Information, "The End!");
        }
示例#24
0
        private static async Task WithLoggerAsync(Func <ILogger, Task> action, string?logFilePath)
        {
            CsvFileLog?csvFileLog = null;
            ConsoleLog?consoleLog = null;
            Logger?    logger     = null;

            try
            {
                if (!string.IsNullOrEmpty(logFilePath))
                {
                    // Needed to satisfy the type checker
                    Contract.AssertNotNull(logFilePath);

                    if (string.IsNullOrEmpty(Path.GetDirectoryName(logFilePath)))
                    {
                        var cwd = Directory.GetCurrentDirectory();
                        logFilePath = Path.Combine(cwd, logFilePath);
                    }

                    csvFileLog = new CsvFileLog(logFilePath, new List <CsvFileLog.ColumnKind>()
                    {
                        CsvFileLog.ColumnKind.PreciseTimeStamp,
                        CsvFileLog.ColumnKind.ProcessId,
                        CsvFileLog.ColumnKind.ThreadId,
                        CsvFileLog.ColumnKind.LogLevel,
                        CsvFileLog.ColumnKind.LogLevelFriendly,
                        CsvFileLog.ColumnKind.Message,
                    });
                }

                consoleLog = new ConsoleLog(useShortLayout: false, printSeverity: true);

                var logs = new ILog?[] { csvFileLog, consoleLog };
                logger = new Logger(logs.Where(log => log != null).Cast <ILog>().ToArray());

                await action(logger);
            }
            finally
            {
                logger?.Dispose();
                csvFileLog?.Dispose();
                consoleLog?.Dispose();
            }
        }
示例#25
0
        private static void LoggingThread()
        {
            DateTime  current = DateTime.Now;
            Stopwatch sw      = new Stopwatch();

            while (s_mainThread.IsAlive)
            {
                DateTime now = DateTime.Now;
                if (current.Day != now.Day)
                {
                    current = now;
                    for (int i = s_loggerCount - 1; i >= 0 && s_mainThread.IsAlive; i--)
                    {
                        Logger?logger = s_loggers[i];
                        if (logger != null)
                        {
                            logger.Flush(true);
                            logger.PrepareLogging(now);
                        }
                    }
                }
                sw.Restart();
                while (sw.Elapsed.TotalMilliseconds < MaxLogAge)
                {
                    for (int i = s_loggerCount - 1; i >= 0 && s_mainThread.IsAlive; i--)
                    {
                        s_loggers[i]?.Flush(false);
                    }
                    Thread.Sleep(1);
                }
                for (int i = s_loggerCount - 1; i >= 0 && s_mainThread.IsAlive; i--)
                {
                    s_loggers[i]?.Flush(true);
                }
            }

            for (int i = s_loggerCount - 1; i >= 0; i--)
            {
                s_loggers[i]?.Dispose();
                s_loggers[i] = null;
            }
            s_loggerCount = 0;
        }
示例#26
0
        public static int Main()
        {
            initLogging(LogLevel.Trace);

            LOGGER = LogManager.GetCurrentClassLogger();

            var fileAssociationService = new FileAssociationService(DRY_RUN);

            try {
                fileAssociationService.fixFileAssociations();
            } catch (ValidationException) {
                return(1);
            } catch (Exception e) when(!(e is OutOfMemoryException))
            {
                LOGGER.Error(e);
                return(2);
            }

            return(0);
        }
示例#27
0
    private static int Main(string[] args)
    {
        int    exitCode;
        Logger?logger = null;

#if LOGGING_ENABLED
        using (logger = new Logger())
#endif
        {
            try
            {
                exitCode = Compile(args, logger);
            }
            catch (Exception e)
            {
                exitCode = -1;
                Console.Error.Write($"Compiler redirection error: {e.GetType()}{Environment.NewLine}{e.Message} {e.StackTrace}");
            }
        }

        return(exitCode);
    }
示例#28
0
 /// <summary>
 /// Creates a Glacier2 session.
 /// </summary>
 /// <param name="callback">The callback for notifications about session
 /// establishment.</param>
 /// <param name="properties">Optional properties used for communicator initialization.</param>
 /// <param name="compactIdResolver">Optional compact type ID resolver delegate used for communicator initialization.</param>
 /// <param name="dispatcher">Optional dispatcher delegate used for communicator initialization.</param>
 /// <param name="logger">Optional logger used for communicator initialization.</param>
 /// <param name="observer">Optional communicator observer used for communicator initialization.</param>
 /// <param name="threadStart">Optional thread start delegate used for communicator initialization.</param>
 /// <param name="threadStop">Optional thread stop delegate used for communicator initialization.</param>
 /// <param name="typeIdNamespaces">Optional list of TypeId namespaces used for communicator initialization.
 /// The default is Ice.TypeId.</param>
 /// <param name="finderStr">The stringified Ice.RouterFinder proxy.</param>
 /// <param name="useCallbacks">True if the session should create an object adapter for receiving callbacks.</param>
 internal SessionHelper(SessionCallback callback,
                        string finderStr,
                        bool useCallbacks,
                        Dictionary <string, string> properties,
                        Func <int, string>?compactIdResolver    = null,
                        Action <Action, Connection?>?dispatcher = null,
                        Logger?logger = null,
                        Ice.Instrumentation.CommunicatorObserver?observer = null,
                        Action?threadStart        = null,
                        Action?threadStop         = null,
                        string[]?typeIdNamespaces = null)
 {
     _callback          = callback;
     _finderStr         = finderStr;
     _useCallbacks      = useCallbacks;
     _properties        = properties;
     _compactIdResolver = compactIdResolver;
     _dispatcher        = dispatcher;
     _logger            = logger;
     _observer          = observer;
     _threadStart       = threadStart;
     _threadStop        = threadStop;
     _typeIdNamespaces  = typeIdNamespaces;
 }
示例#29
0
        public List <LogEvent> ReadLogs(string filePath, Logger?logger = null)
        {
            var logItems = new List <LogEvent>();

            using (var fs = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
            {
                using (var stream = new StreamReader(fs))
                {
                    using (var reader = new LogEventReader(stream))
                    {
                        while (TryRead(reader, out var evt))
                        {
                            if (evt == null)
                            {
                                continue;
                            }

                            if (logger != null)
                            {
                                //We can persist the log item (using the passed in Serilog config)
                                //In this case a Logger with File Sink setup
                                logger.Write(evt);
                            }

                            logItems.Add(evt);
                        }
                    }
                }
            }

            _logItems   = logItems;
            LogFilePath = filePath;
            LogIsOpen   = true;

            return(_logItems);
        }
示例#30
0
        private void StartService(string service, string entryPoint, string[] args)
        {
            lock (this)
            {
                //
                // Extract the assembly name and the class name.
                //
                int sepPos = entryPoint.IndexOf(':');
                if (sepPos != -1)
                {
                    const string driveLetters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
                    if (entryPoint.Length > 3 &&
                        sepPos == 1 &&
                        driveLetters.IndexOf(entryPoint[0]) != -1 &&
                        (entryPoint[2] == '\\' || entryPoint[2] == '/'))
                    {
                        sepPos = entryPoint.IndexOf(':', 3);
                    }
                }
                if (sepPos == -1)
                {
                    throw new FormatException($"invalid entry point format `{entryPoint}");
                }

                System.Reflection.Assembly?serviceAssembly = null;
                string assemblyName = entryPoint.Substring(0, sepPos);
                string className    = entryPoint.Substring(sepPos + 1);

                try
                {
                    //
                    // First try to load the assembly using Assembly.Load, which will succeed
                    // if a fully-qualified name is provided or if a partial name has been qualified
                    // in configuration. If that fails, try Assembly.LoadFrom(), which will succeed
                    // if a file name is configured or a partial name is configured and DEVPATH is used.
                    //
                    try
                    {
                        serviceAssembly = System.Reflection.Assembly.Load(assemblyName);
                    }
                    catch (System.Exception ex)
                    {
                        try
                        {
                            serviceAssembly = System.Reflection.Assembly.LoadFrom(assemblyName);
                        }
                        catch (System.Exception)
                        {
#pragma warning disable CA2200 // Rethrow to preserve stack details.
                            throw ex;
#pragma warning restore CA2200 // Rethrow to preserve stack details.
                        }
                    }
                }
                catch (System.Exception ex)
                {
                    throw new InvalidOperationException(
                              $"ServiceManager: unable to load service '{entryPoint}': error loading assembly: {assemblyName}", ex);
                }

                //
                // Instantiate the class.
                //
                Type?c = null;
                try
                {
                    c = serviceAssembly.GetType(className, true);
                }
                catch (System.Exception ex)
                {
                    throw new InvalidOperationException(
                              $"ServiceManager: unable to load service '{entryPoint}': cannot find the service class `{className}'", ex);
                }

                ServiceInfo info = new ServiceInfo(service, ServiceStatus.Stopped, args);

                Logger?logger = null;
                //
                // If IceBox.UseSharedCommunicator.<name> is defined, create a
                // communicator for the service. The communicator inherits
                // from the shared communicator properties. If it's not
                // defined, add the service properties to the shared
                // commnunicator property set.
                //
                Communicator communicator;
                if (_communicator.GetPropertyAsInt($"IceBox.UseSharedCommunicator.{service}") > 0)
                {
                    Debug.Assert(_sharedCommunicator != null);
                    communicator = _sharedCommunicator;
                }
                else
                {
                    //
                    // Create the service properties. We use the communicator properties as the default
                    // properties if IceBox.InheritProperties is set.
                    //
                    Dictionary <string, string> properties = CreateServiceProperties(service);
                    if (info.Args.Length > 0)
                    {
                        //
                        // Create the service properties with the given service arguments. This should
                        // read the service config file if it's specified with --Ice.Config.
                        //
                        properties.ParseIceArgs(ref info.Args);

                        //
                        // Next, parse the service "<service>.*" command line options (the Ice command
                        // line options were parsed by the createProperties above)
                        //
                        properties.ParseArgs(ref info.Args, service);
                    }

                    //
                    // Clone the logger to assign a new prefix. If one of the built-in loggers is configured
                    // don't set any logger.
                    //
                    string?logFile;
                    if (properties.TryGetValue("Ice.LogFile", out logFile))
                    {
                        logger = _logger.cloneWithPrefix(properties.GetValueOrDefault("Ice.ProgramName") ?? "");
                    }

                    //
                    // If Admin is enabled on the IceBox communicator, for each service that does not set
                    // Ice.Admin.Enabled, we set Ice.Admin.Enabled=1 to have this service create facets; then
                    // we add these facets to the IceBox Admin object as IceBox.Service.<service>.<facet>.
                    //
                    string serviceFacetNamePrefix = "IceBox.Service." + service + ".";
                    bool   addFacets = ConfigureAdmin(properties, serviceFacetNamePrefix);

                    //
                    // Remaining command line options are passed to the communicator. This is
                    // necessary for Ice plug-in properties (e.g.: IceSSL).
                    //
                    info.Communicator = new Communicator(ref info.Args, properties, logger: logger);
                    communicator      = info.Communicator;

                    if (addFacets)
                    {
                        // Add all facets created on the service communicator to the IceBox communicator
                        // but renamed IceBox.Service.<service>.<facet-name>, except for the Process facet
                        // which is never added
                        foreach (var p in communicator.FindAllAdminFacets())
                        {
                            if (!p.Key.Equals("Process"))
                            {
                                _communicator.AddAdminFacet(p.Value.servant, p.Value.disp, serviceFacetNamePrefix + p.Key);
                            }
                        }
                    }
                }

                try
                {
                    //
                    // Instantiate the service.
                    //
                    Service?s;
                    try
                    {
                        //
                        // If the service class provides a constructor that accepts an Ice.Communicator argument,
                        // use that in preference to the default constructor.
                        //
                        Type[] parameterTypes = new Type[1];
                        parameterTypes[0] = typeof(Communicator);
                        System.Reflection.ConstructorInfo?ci = c.GetConstructor(parameterTypes);
                        if (ci != null)
                        {
                            object[] parameters = new object[1];
                            parameters[0] = _communicator;
                            s             = (Service)ci.Invoke(parameters);
                        }
                        else
                        {
                            //
                            // Fall back to the default constructor.
                            //
                            s = (Service?)IceInternal.AssemblyUtil.createInstance(c);
                        }
                    }
                    catch (System.Exception ex)
                    {
                        throw new InvalidOperationException($"ServiceManager: unable to load service '{entryPoint}", ex);
                    }

                    if (s == null)
                    {
                        throw new InvalidOperationException(
                                  $"ServiceManager: unable to load service '{entryPoint}': " +
                                  $"no default constructor for `{className}'");
                    }
                    info.Service = s;

                    try
                    {
                        info.Service.start(service, communicator, info.Args);
                    }
                    catch (System.Exception ex)
                    {
                        throw new InvalidOperationException($"ServiceManager: exception while starting service {service}", ex);
                    }

                    info.Status = ServiceStatus.Started;
                    _services.Add(info);
                }
                catch (System.Exception)
                {
                    if (info.Communicator != null)
                    {
                        destroyServiceCommunicator(service, info.Communicator);
                    }

                    throw;
                }
            }
        }