Show custom message in Error List C# vsix extension

396 views Asked by At

I am creating a VSIX extension. Here I have added errors in Error List but, the issue bar (just upside to the error list) is still showing No issues found followed by a green mark (follow the attached image):

Image 1

These 7 Errors must be shown on the issue bar as the VS IDE usually do, as the following image:

Image 2

Now, I want my project to work/show errors like 2nd Image. Following is my code for adding these custom errors :

internal static class ErrorListManager
{
    public static ErrorListProvider errorListProvider;

    public static void Initialize(IServiceProvider serviceProvider) 
    {
        errorListProvider = new ErrorListProvider(serviceProvider);
    }

    public static void AddError(string errorMsg) {
        AddTask(errorMsg, TaskErrorCategory.Error);
    }

    private static void AddTask(string errorMsg, TaskErrorCategory category)
    {
        errorListProvider.Tasks.Add(new ErrorTask
        {
            Category = TaskCategory.User,
            ErrorCategory = category,
            Text = errorMsg
        });
    }
}
private void CreateVisualsCall(List<string> templist2, int markCountLoc)
{
    //if (this.checkCountIfMarked <= markCountLoc)
    if (markCountLoc > 0)
    {
        //this.markthis.Clear();
        //CreateVisuals(templist2[templist2.Count - this.checkCountIfMarked],markCountLoc,templist2);
        CreateVisuals(templist2[templist2.Count - markCountLoc], markCountLoc, templist2);
    }
    else
    {
            foreach (Image img in this.drawingImageList) { 

            // Align the image with the top of the bounds of the text geometry
            //Canvas.SetLeft(img, this.geometry.Bounds.Left);
            //Canvas.SetTop(img, this.geometry.Bounds.Top);

            this.layer.AddAdornment(AdornmentPositioningBehavior.OwnerControlled, span, null, img, null);
        }

        -------
        ErrorListManager.AddError("Test  Message");//only this line is calling and creating custom error!
        ------- 
    }
}

My question is: How can I remove "No issues found (as in img 1)" and place the errors over that (like img 2)

I followed this tutorial for creating up to this.

0

There are 0 answers