/// <summary>
        /// Asynchronously tries to populate the marker collection, returns true if there was a change in marker count and the callee should update
        /// </summary>
        /// <param name="forceUpdate">When set to true, ignores if the collection is empty</param>
        /// <returns></returns>
        public async System.Threading.Tasks.Task <bool> TrySetMarkersAsync(bool forceUpdate = false)
        {
            Uri  uri    = null;
            bool result = false;

            using (var metrics = Log.WithMetrics($"{nameof(DocumentMarkerManager)}:{nameof(TrySetMarkersAsync)}")) {
                try {
                    if (_markers != null && _markers.Markers.AnySafe() == false && !forceUpdate)
                    {
                        Log.Verbose($"Codemarks are empty and forceUpdate={forceUpdate}", forceUpdate);
                        return(false);
                    }

                    uri = _virtualTextDocument.Uri;
                    if (uri == null)
                    {
                        Log.Verbose($"Could not get virtual text document");
                        return(false);
                    }

                    _markers = await _agentService.GetMarkersForDocumentAsync(uri);

                    bool?previousResult = null;
                    if (_markers?.Markers.AnySafe() == true || forceUpdate)
                    {
                        if (_wpfTextView.Properties.TryGetProperty(PropertyNames
                                                                   .DocumentMarkers, out List <DocumentMarker> previousMarkersResponse))
                        {
                            previousResult = previousMarkersResponse.AnySafe();
                        }
                        _wpfTextView.Properties.RemovePropertySafe(PropertyNames.DocumentMarkers);
                        _wpfTextView.Properties.AddProperty(PropertyNames.DocumentMarkers, _markers?.Markers);
                        Log.Verbose($"Setting Markers({_markers?.Markers.Count}) for {uri}");

                        var current = _markers?.Markers.Any() == true;
                        if (previousResult == true && current == false)
                        {
                            result = true;
                        }
                        else if (current)
                        {
                            result = true;
                        }
                    }
                    else
                    {
                        Log.Verbose("No Codemarks from agent");
                    }
                    if (_markers?.MarkersNotLocated?.AnySafe() == true)
                    {
                        Log.Verbose($"There are {_markers?.MarkersNotLocated.Count()} markers not located");
                    }
                }
                catch (OverflowException ex) {
                    Log.Error(ex, uri?.ToString());
                }
                catch (Exception ex) {
                    Log.Error(ex, nameof(TrySetMarkersAsync));
                }
            }
            return(result);
        }
        /// <summary>
        /// Asynchronously tries to populate the marker collection, returns true if there was a change in marker count and the callee should update
        /// </summary>
        /// <param name="forceUpdate">When set to true, ignores if the collection is empty</param>
        /// <returns></returns>
        public async System.Threading.Tasks.Task <bool> TrySetMarkersAsync(bool forceUpdate = false)
        {
            Uri  fileUri = null;
            bool result  = false;

            try {
                if (_markers != null && _markers.Markers.AnySafe() == false && !forceUpdate)
                {
                    Log.Verbose($"Codemarks are empty and forceUpdate={forceUpdate}", forceUpdate);
                    return(false);
                }

                fileUri = _textDocument.FilePath.ToUri();
                if (fileUri == null)
                {
                    Log.Verbose($"Could not parse file path as uri={_textDocument.FilePath}");
                    return(false);
                }

                _markers = await _agentService.GetMarkersForDocumentAsync(fileUri, true);

                bool?previousResult = null;
                if (_markers?.Markers.AnySafe() == true || forceUpdate)
                {
                    if (_wpfTextView.Properties.TryGetProperty(PropertyNames
                                                               .DocumentMarkers, out List <DocumentMarker> previousMarkersResponse))
                    {
                        previousResult = previousMarkersResponse.AnySafe();
                    }
                    _wpfTextView.Properties.RemovePropertySafe(PropertyNames.DocumentMarkers);
                    _wpfTextView.Properties.AddProperty(PropertyNames.DocumentMarkers, _markers?.Markers);
                    Log.Verbose($"Setting Markers({_markers?.Markers.Count}) for {fileUri}");

                    var current = _markers?.Markers.Any() == true;
                    if (previousResult == true && current == false)
                    {
                        result = true;
                    }
                    else if (current)
                    {
                        result = true;
                    }
                }
                else
                {
                    Log.Verbose("No Codemarks from agent");
                }
                if (_markers?.MarkersNotLocated?.AnySafe() == true)
                {
                    Log.Verbose($"There are {_markers?.MarkersNotLocated.Count()} markers not located");
                }
            }
            catch (OverflowException ex) {
                Log.Error(ex, fileUri?.ToString());
            }
            catch (Exception ex) {
                Log.Error(ex, nameof(TrySetMarkersAsync));
            }

            return(result);
        }