public async Task <ReferenceCount> GetReferenceCountAsync(CodeLensArguments arguments, int maxResultCount) { try { var documentId = arguments.GetDocumentId(); var textSpan = arguments.GetTextSpan(); using (Internal.Log.Logger.LogBlock(FunctionId.CodeAnalysisService_GetReferenceCountAsync, documentId.ProjectId.DebugName, CancellationToken)) { var solution = await GetSolutionAsync().ConfigureAwait(false); var syntaxNode = (await solution.GetDocument(documentId).GetSyntaxRootAsync().ConfigureAwait(false)).FindNode(textSpan); return(await CodeLensReferencesServiceFactory.Instance.GetReferenceCountAsync(solution, documentId, syntaxNode, maxResultCount, CancellationToken).ConfigureAwait(false)); } } catch (IOException) { // stream to send over result has closed before we // had chance to check cancellation } catch (OperationCanceledException) { // rpc connection has closed. // this can happen if client side cancelled the // operation } return(null); }