public override async Task <TagHelperResolutionResult> GetTagHelpersAsync(Project project, CancellationToken cancellationToken) { if (project == null) { throw new ArgumentNullException(nameof(project)); } try { TagHelperResolutionResult result = null; // We're being defensive here because the OOP host can return null for the client/session/operation // when it's disconnected (user stops the process). var client = await RazorLanguageServiceClientFactory.CreateAsync(_workspace, cancellationToken); if (client != null) { using (var session = await client.CreateSessionAsync(project.Solution)) { if (session != null) { var jsonObject = await session.InvokeAsync <JObject>( "GetTagHelpersAsync", new object[] { project.Id.Id, "Foo", }, cancellationToken).ConfigureAwait(false); result = GetTagHelperResolutionResult(jsonObject); } } } if (result == null) { // Was unable to get tag helpers OOP, fallback to default behavior. result = await _defaultResolver.GetTagHelpersAsync(project, cancellationToken); } return(result); } catch (Exception exception) { throw new InvalidOperationException( Resources.FormatUnexpectedException( typeof(DefaultTagHelperResolver).FullName, nameof(GetTagHelpersAsync)), exception); } }
protected virtual Task <TagHelperResolutionResult> ResolveTagHelpersInProcessAsync(Project project, ProjectSnapshot projectSnapshot) { return(_defaultResolver.GetTagHelpersAsync(project, projectSnapshot)); }