Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Failed to generate generated classes in Azure Devops with Refit version 6.3.2 and 7.0.0 #1601

Open
pesderes opened this issue Nov 15, 2023 · 0 comments
Labels

Comments

@pesderes
Copy link

pesderes commented Nov 15, 2023

Describe the bug 🐞

We encounter an issue indicating "***API doesn't look like a Refit interface. Make sure it has at least one method with a Refit HTTP method attribute and Refit is installed in the project." when invoking Refit-produced APIs. The functionality is successful in the locally built version, but the error arises in the Azure DevOps build.

The problem persists with Refit versions 6.3.2 and 7.0.0. Interestingly, it works without issues when using Refit version 5.x.x.

I see the similar issues reported and possible culprit was from SonarQube. But we don't use it.

I examined the logs with diagnostic logging enabled but couldn't identify any indications of problems. Can someone provide guidance on resolving this issue?

Refit interface

namespace XXX
{
    using System.Collections.Generic;
    using System.Threading.Tasks;
    using Refit;

    public interface IJsonPlaceholderAPI
    {
        /// <summary>
        /// GetPosts
        /// </summary>
        /// <returns>A <see cref="Task{TResult}"/> representing the result of the asynchronous operation.</returns>
        [Get("/posts")]
        Task<List<Post>> GetPostsAsync();
    }
}

Data contract class

    public class Post
    {
        /// <summary>
        /// Gets or sets id
        /// </summary>
        public int Id { get; set; }

        /// <summary>
        /// Gets or sets id
        /// </summary>
        public int UserId { get; set; }

        /// <summary>
        /// Gets or sets id
        /// </summary>
        public string Title { get; set; }

        /// <summary>
        /// Gets or sets id
        /// </summary>
        public string Body { get; set; }
    }

Step to reproduce

dotnet.exe build .sln --no-restore --no-incremental --configuration Release -p:platform="x64" -p:SourceRevisionId=... -v:n -flp1:Verbosity=d;LogFile=.log;Encoding=UTF-8 -flp2:logfile=.err;errorsonly -bl:.binlog /p:Features="IOperation,flow-analysis" /p:CodeAnalysisRuleSet="" /p:TreatWarningsAsErrors=false /p:RunCodeAnalysis=false /p:GdnRoslynAnalyzersRunId=

Reproduction repository

https://github.com/reactiveui/refit

Expected behavior

This should happen...

Screenshots 🖼️

In local build, I see that the auto-generated classes in the nuget package.

image

But, I cannot find the auto-generated classes in the nuget package that was build in Aure DevOps.

IDE

Visual Studio 2022

Operating system

Windows

Version

MSBuild version 17.7.3+8ec440e68 for .NET

Device

No response

Refit Version

6.3.2

Additional information ℹ️

No response

@pesderes pesderes added the bug label Nov 15, 2023
@pesderes pesderes reopened this Nov 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant