Skip to content

Build is not stopped #15

Description

@maciekpazola

Good afternoon,

I’ve encountered an issue while using the VRT .NET SDK. After calling the Stop() method, the build is not being marked as stopped in the application.

Image

After some investigation, it appears that the API client does not include the required request body:

{
"isRunning": false
}

Because of this, the build remains in a running state and is not properly finalized.

Best regards,

Problematic code inside of a Stop method:

public async Task<BuildDto> BuildsController_stopAsync(string id, CancellationToken cancellationToken)
{
    if (id == null)
    {
        throw new ArgumentNullException("id");
    }

    StringBuilder stringBuilder = new StringBuilder();
    stringBuilder.Append((BaseUrl != null) ? BaseUrl.TrimEnd('/') : "").Append("/builds/{id}");
    stringBuilder.Replace("{id}", Uri.EscapeDataString(ConvertToString(id, CultureInfo.InvariantCulture)));
    HttpClient httpClient = _httpClient;
    using HttpRequestMessage request_ = new HttpRequestMessage();
    request_.Content = new StringContent(string.Empty, Encoding.UTF8, "application/json");
    request_.Method = new HttpMethod("PATCH");
    request_.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json"));
    string text = stringBuilder.ToString();
    request_.RequestUri = new Uri(text, UriKind.RelativeOrAbsolute);
    PrepareRequest(httpClient, request_, text);
    HttpResponseMessage response_ = await httpClient.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(continueOnCapturedContext: false);
    try
    {
        Dictionary<string, IEnumerable<string>> headers_ = response_.Headers.ToDictionary<KeyValuePair<string, IEnumerable<string>>, string, IEnumerable<string>>((KeyValuePair<string, IEnumerable<string>> h_) => h_.Key, (KeyValuePair<string, IEnumerable<string>> h_) => h_.Value);
        if (response_.Content != null && response_.Content.Headers != null)
        {
            foreach (KeyValuePair<string, IEnumerable<string>> header in response_.Content.Headers)
            {
                headers_[header.Key] = header.Value;
            }
        }

        string text2 = ((int)response_.StatusCode).ToString();
        if (text2 == "200")
        {
            return (await ReadObjectResponseAsync<BuildDto>(response_, headers_).ConfigureAwait(continueOnCapturedContext: false)).Object;
        }

        if (text2 != "200" && text2 != "204")
        {
            string text3 = ((response_.Content != null) ? (await response_.Content.ReadAsStringAsync().ConfigureAwait(continueOnCapturedContext: false)) : null);
            string response = text3;
            throw new ApiException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, response, headers_, null);
        }

        return null;
    }
    finally
    {
        response_?.Dispose();
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions