Q:

AzureDevOps Build Rest API: How to get all Warning count in build Task, exceed the limit of 10

I am trying to get on an AzureDevOps project the number of Warning for a build task. But I still only get the first 10 warnings. How do you do it all? I especially need the number of warning, not necessarily the detail of the warning
var credential = new VssBasicCredential(string.Empty, myPat);
var connection = new VssConnection(new Uri(myCollection), credential);
var buildClient = connection.GetClient<BuildHttpClient>();
var timeline = buildClient.GetBuildTimelineAsync(myProject, myBuildId).Result;
var vsTask= timeline.Records.FirstOrDefault(p => p?.Task?.Name == "VSBuild");
// always 10 utmost  : warning and issues !!
var warning = vsTask.WarningCount;
var issues =  vsTask.Issues;

A:

This is really strange, but it looks that you cannot go above what is shown here

There is workaround (but it is a bit ugly). You can load log page and count warnings parsing the page.
static void Main(string[] args)
{
    var credential = new VssBasicCredential(string.Empty, "PAT");
    var connection = new VssConnection(new Uri("https://dev.azure.com/your-organization/"), credential);
    var buildClient = connection.GetClient<BuildHttpClient>();
    var timeline = buildClient.GetBuildTimelineAsync("yoyr project", 377).Result;

    var vsTask = timeline.Records.FirstOrDefault(p => p?.Task?.Name == "VSBuild");
    // always 10 utmost  : warning and issues !!
    var warning = vsTask.WarningCount;
    var issues = vsTask.Issues;
    Console.WriteLine(warning);

    HttpClient client = new HttpClient();
    var response =  client.GetAsync(vsTask.Log.Url);
    var pageContents = response.Result.Content.ReadAsStringAsync().Result;
    var realNumberOfWarnings = AllIndexesOf(pageContents, "##[warning]");
    Console.WriteLine(realNumberOfWarnings.Count);
    Console.ReadLine();
}

public static List<int> AllIndexesOf(string str, string value)
{
    if (String.IsNullOrEmpty(value))
        throw new ArgumentException("the string to find may not be empty", "value");
    List<int> indexes = new List<int>();
    for (int index = 0; ; index += value.Length)
    {
        index = str.IndexOf(value, index);
        if (index == -1)
            return indexes;
        indexes.Add(index);
    }
}

I hope it will help.
Please check what Tingluo Huang [MSFT] wrote here:

We should only count and store 10 errors/warning (i guess we having
  some counting bug, so we count to 11), those issues get stored in our
  backend DB for driving the build summary page render. We don't want to
  store too many errors/warning since most of the time the first few
  errors/warnings are key to the problem, and the rest are just noise.

