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

CLI: Build error: 'BaseRequestBuilder' does not contain a constructor that takes 0 arguments #2459

Closed
jasonjoh opened this issue Mar 24, 2023 · 8 comments · Fixed by #2472
Closed
Assignees
Labels
CLI Work to support generating CLIs with Kiota type:bug A broken experience
Milestone

Comments

@jasonjoh
Copy link
Member

With latest source, and generating a client from https://github.com/microsoft/kiota-samples/blob/main/get-started/quickstart/posts-api.yml, the generated client class and request builder classes fail to compile.

C:\Source\Repos\kiota-samples\get-started\quickstart\cli\src\Client\PostsClient.cs(46,32): error CS1729: 'BaseRequestBuilder' does not contain a const 
ructor that takes 0 arguments [C:\Source\Repos\kiota-samples\get-started\quickstart\cli\src\KiotaPostsCLI.csproj]
C:\Source\Repos\kiota-samples\get-started\quickstart\cli\src\Client\Posts\PostsRequestBuilder.cs(135,81): error CS1729: 'BaseRequestBuilder' does not  
contain a constructor that takes 0 arguments [C:\Source\Repos\kiota-samples\get-started\quickstart\cli\src\KiotaPostsCLI.csproj]
C:\Source\Repos\kiota-samples\get-started\quickstart\cli\src\Client\Posts\Item\PostItemRequestBuilder.cs(158,84): error CS1729: 'BaseRequestBuilder' d 
oes not contain a constructor that takes 0 arguments [C:\Source\Repos\kiota-samples\get-started\quickstart\cli\src\KiotaPostsCLI.csproj]
    0 Warning(s)
    3 Error(s)

All of these classes inherit from BaseRequestBuilder, and have constructors like:

public PostsRequestBuilder(Dictionary<string, object> pathParameters) : base() {
}

The base() is what's causing the error.

Dependency versions

<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.1" />
<PackageReference Include="Microsoft.Kiota.Abstractions" Version="1.1.0" />
<PackageReference Include="Microsoft.Kiota.Cli.Commons" Version="0.1.13-preview.1" />
<PackageReference Include="Microsoft.Kiota.Http.HttpClientLibrary" Version="1.0.1" />
<PackageReference Include="Microsoft.Kiota.Serialization.Form" Version="1.0.1" />
<PackageReference Include="Microsoft.Kiota.Serialization.Json" Version="1.0.3" />
<PackageReference Include="Microsoft.Kiota.Serialization.Text" Version="1.0.1" />
@baywet baywet added type:bug A broken experience CLI Work to support generating CLIs with Kiota and removed Needs: Triage 🔍 labels Mar 24, 2023
@baywet baywet added this to the Kiota v1.1 milestone Mar 24, 2023
@baywet
Copy link
Member

baywet commented Mar 24, 2023

Thanks for reporting this. It's probably caused by the changes made in #2406 where the constructor writer needs to handle another case.
@calebkiage can you look into that please?

@andreaTP
Copy link
Contributor

@baywet , I did a little bit of bisecting and it looks like that #2406 has pretty much broken all of the IT tests with a compatible error, e.g. in Java:

cannot find symbol
[ERROR]   symbol:   class BaseRequestBuilder
[ERROR]   location: package com.microsoft.kiota

@baywet
Copy link
Member

baywet commented Mar 29, 2023

I believe this is because the references to the abstractions package are not up to date in the case of most languages. Would you mind trying to update them please?

@baywet baywet linked a pull request Mar 29, 2023 that will close this issue
@baywet
Copy link
Member

baywet commented Mar 29, 2023

Also this has been fixed by @calebkiage in #2472

@baywet baywet closed this as completed Mar 29, 2023
@andreaTP
Copy link
Contributor

Just tested and the error is still present in latest main, at least for Java updating kiota-java libs to 0.3.3 (latest as of now).

@andreaTP
Copy link
Contributor

@andreaTP
Copy link
Contributor

andreaTP commented Mar 29, 2023

Go and Ruby are manifesting the same issue, should we open separate issues?
cc. @baywet

@baywet
Copy link
Member

baywet commented Mar 29, 2023

please do

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLI Work to support generating CLIs with Kiota type:bug A broken experience
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants