protected override void OnStart(string[] args) { if (this.serviceThread != null) { throw new InvalidOperationException("Cannot start service twice in a row."); } // TODO: 865304 Used for functional tests only. Replace with a smarter appConfig-based solution string serviceName = args.FirstOrDefault(arg => arg.StartsWith(ServiceNameArgPrefix)); if (serviceName != null) { this.serviceName = serviceName.Substring(ServiceNameArgPrefix.Length); } this.serviceDataLocation = GVFSService.GetServiceDataRoot(this.serviceName); Directory.CreateDirectory(this.serviceDataLocation); this.tracer.AddLogFileEventListener( GVFSEnlistment.GetNewGVFSLogFileName(GVFSService.GetServiceLogsRoot(this.serviceName), GVFSConstants.LogFileTypes.Service), EventLevel.Verbose, Keywords.Any); try { this.Start(); } catch (Exception e) { this.LogExceptionAndExit(e, nameof(this.OnStart)); } }