public void Run() { try { EventMetadata metadata = new EventMetadata(); metadata.Add("Version", ProcessHelper.GetCurrentProcessVersion()); this.tracer.RelatedEvent(EventLevel.Informational, $"{nameof(GVFSService)}_{nameof(this.Run)}", metadata); this.repoRegistry = new RepoRegistry( this.tracer, new PhysicalFileSystem(), this.serviceDataLocation, new GVFSMountProcess(this.tracer), this.notificationHandler); this.repoRegistry.Upgrade(); this.requestHandler = new WindowsRequestHandler(this.tracer, EtwArea, this.repoRegistry); string pipeName = GVFSPlatform.Instance.GetGVFSServiceNamedPipeName(this.serviceName); this.tracer.RelatedInfo("Starting pipe server with name: " + pipeName); using (NamedPipeServer pipeServer = NamedPipeServer.StartNewServer( pipeName, this.tracer, this.requestHandler.HandleRequest)) { this.CheckEnableGitStatusCacheTokenFile(); using (ITracer activity = this.tracer.StartActivity("EnsurePrjFltHealthy", EventLevel.Informational)) { // Make a best-effort to enable PrjFlt. Continue even if it fails. // This will be tried again when user attempts to mount an enlistment. string error; EnableAndAttachProjFSHandler.TryEnablePrjFlt(activity, out error); } // Start product upgrade timer only after attempting to enable prjflt. // On Windows server (where PrjFlt is not inboxed) this helps avoid // a race between TryEnablePrjFlt() and installer pre-check which is // performed by UpgradeTimer in parallel. this.productUpgradeTimer.Start(); this.serviceStopped.WaitOne(); } } catch (Exception e) { this.LogExceptionAndExit(e, nameof(this.Run)); } }
public void Run() { try { EventMetadata metadata = new EventMetadata(); metadata.Add("Version", ProcessHelper.GetCurrentProcessVersion()); this.tracer.RelatedEvent(EventLevel.Informational, $"{nameof(GVFSService)}_{nameof(this.Run)}", metadata); this.repoRegistry = new RepoRegistry( this.tracer, new PhysicalFileSystem(), Path.Combine(GVFSPlatform.Instance.GetCommonAppDataRootForGVFS(), this.serviceName), new GVFSMountProcess(this.tracer), this.notificationHandler); this.repoRegistry.Upgrade(); this.requestHandler = new WindowsRequestHandler(this.tracer, EtwArea, this.repoRegistry); string pipeName = GVFSPlatform.Instance.GetGVFSServiceNamedPipeName(this.serviceName); this.tracer.RelatedInfo("Starting pipe server with name: " + pipeName); using (NamedPipeServer pipeServer = NamedPipeServer.StartNewServer( pipeName, this.tracer, this.requestHandler.HandleRequest)) { this.CheckEnableGitStatusCacheTokenFile(); using (ITracer activity = this.tracer.StartActivity("EnsurePrjFltHealthy", EventLevel.Informational)) { // Make a best-effort to enable PrjFlt. Continue even if it fails. // This will be tried again when user attempts to mount an enlistment. string error; EnableAndAttachProjFSHandler.TryEnablePrjFlt(activity, out error); } this.serviceStopped.WaitOne(); } } catch (Exception e) { this.LogExceptionAndExit(e, nameof(this.Run)); } }