Quantcast
Channel: YouTrackReSharper (RSRP) - Bug and Issue Tracker
Viewing all articles
Browse latest Browse all 106942

RSRP-467809: Incorrect quick fix.

$
0
0
Reporter Mikhail Filippov (Mikhail.Filippov) Mikhail Filippov (Mikhail.Filippov)
Created Jan 2, 2018 3:49:54 PM
Updated Apr 26, 2018 5:50:41 PM
Subsystem Quick Fixes
Assignee Andrew Karpov (andrew.karpov)
Priority Normal
State Submitted
Type Bug
Fix version No Fix versions
Affected versions No Affected versions
Fixed In Version ReSharper Undefined
VsVersion All Versions

For code:

public async Task<TextTrack> GetTextTrackAsync(long videoId, long trackId)
{
    try
    {
        var request = GenerateTextTracksRequest(videoId, trackId);
        var response = await request.ExecuteRequestAsync<TextTrack>();
        UpdateRateLimit(response);
        CheckStatusCodeError(response, "Error retrieving text track for video.", HttpStatusCode.NotFound);

        if (response.StatusCode == HttpStatusCode.NotFound)
        {
            return null;
        }
        return response.Content;
    }
    catch (Exception ex)
    {
        if (ex is VimeoApiException)
        {
            throw;
        }
        throw new VimeoApiException("Error retrieving text track for video.", ex);
    }
}

ReSharper advise convert if to ?: operator but it convert to incorrect code:

public async Task<TextTrack> GetTextTrackAsync(long videoId, long trackId)
{
    try
    {
        var request = GenerateTextTracksRequest(videoId, trackId);
        var response = await request.ExecuteRequestAsync<TextTrack>();
        UpdateRateLimit(response);
        CheckStatusCodeError(response, "Error retrieving text track for video.", HttpStatusCode.NotFound);

        return response.StatusCode == HttpStatusCode.NotFound ? null : (Task<TextTrack>) response.Content;
    }
    catch (Exception ex)
    {
        if (ex is VimeoApiException)
        {
            throw;
        }
        throw new VimeoApiException("Error retrieving text track for video.", ex);
    }
}

Where code: "(Task<TextTrack>)" is incorrect. For fix I should remove this cast.
VimeoClient_TextTracks.cs(57, 80): [CS0030] Cannot convert type 'VimeoDotNet.Models.TextTrack' to 'System.Threading.Tasks.Task<VimeoDotNet.Models.TextTrack>'


Viewing all articles
Browse latest Browse all 106942

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>