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

Kiota v1.16.0 generated "CS1587: XML comment is not placed on a valid language element" error #4957

Closed
HowardvanRooijen opened this issue Jul 10, 2024 · 4 comments · Fixed by #4967
Assignees
Labels
Csharp Pull requests that update .net code type:bug A broken experience
Milestone

Comments

@HowardvanRooijen
Copy link

What are you generating using Kiota, clients or plugins?

API Client/SDK

In what context or format are you using Kiota?

Nuget tool

Client library/SDK language

Csharp

Describe the bug

I am trying to update our C# Firecracker Management client - update to the latest Kiota packages / regenerate the client using the latest .NET Global Tool

Tool 'microsoft.openapi.kiota' was successfully updated from version '1.14.0' to version '1.16.0'.

Ran the the tool to regenerate the client

kiota generate -l CSharp -c FirecrackerManagementClient -n Firecracker.Management -d https://raw.githubusercontent.com/firecracker-microvm/firecracker/main/src/firecracker/swagger/firecracker.yaml -o "c:\temp\firecracker\client"

And when I build the project, I get the following errors:

c:\temp\firecracker\client\Models\CpuTemplate.cs(8,5,8,6): error CS1587: XML comment is not placed on a valid language element
c:\temp\firecracker\client\Models\Drive_cache_type.cs(8,5,8,6): error CS1587: XML comment is not placed on a valid language element
c:\temp\firecracker\client\Models\Drive_io_engine.cs(7,5,7,6): error CS1587: XML comment is not placed on a valid language element
c:\temp\firecracker\client\Models\InstanceActionInfo_action_type.cs(7,5,7,6): error CS1587: XML comment is not placed on a valid language element
c:\temp\firecracker\client\Models\InstanceInfo_state.cs(7,5,7,6): error CS1587: XML comment is not placed on a valid language element
c:\temp\firecracker\client\Models\Logger_level.cs(7,5,7,6): error CS1587: XML comment is not placed on a valid language element
c:\temp\firecracker\client\Models\MachineConfiguration_huge_pages.cs(7,5,7,6): error CS1587: XML comment is not placed on a valid language element
c:\temp\firecracker\client\Models\MmdsConfig_version.cs(7,5,7,6): error CS1587: XML comment is not placed on a valid language element
c:\temp\firecracker\client\Models\SnapshotCreateParams_snapshot_type.cs(7,5,7,6): error CS1587: XML comment is not placed on a valid language element

All the files above are enums:

CpuTemplate.cs included below:

// <auto-generated/>
using System.Runtime.Serialization;
using System;
namespace Firecracker.Management.Models
{
    [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.16.0")]
    /// <summary>The CPU Template defines a set of flags to be disabled from the microvm so that the features exposed to the guest are the same as in the selected instance type. This parameter has been deprecated and it will be removed in future Firecracker release.</summary>
    public enum CpuTemplate
    {
        [EnumMember(Value = "C3")]
        #pragma warning disable CS1591
        C3,
        #pragma warning restore CS1591
        [EnumMember(Value = "T2")]
        #pragma warning disable CS1591
        T2,
        #pragma warning restore CS1591
        [EnumMember(Value = "T2S")]
        #pragma warning disable CS1591
        T2S,
        #pragma warning restore CS1591
        [EnumMember(Value = "T2CL")]
        #pragma warning disable CS1591
        T2CL,
        #pragma warning restore CS1591
        [EnumMember(Value = "T2A")]
        #pragma warning disable CS1591
        T2A,
        #pragma warning restore CS1591
        [EnumMember(Value = "V1N1")]
        #pragma warning disable CS1591
        V1N1,
        #pragma warning restore CS1591
        [EnumMember(Value = "None")]
        #pragma warning disable CS1591
        None,
        #pragma warning restore CS1591
    }
}

The issue seem to be with [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.16.0")]

Expected behavior

For the code to compile :D

How to reproduce

kiota generate -l CSharp -c FirecrackerManagementClient -n Firecracker.Management -d https://raw.githubusercontent.com/firecracker-microvm/firecracker/main/src/firecracker/swagger/firecracker.yaml -o "c:\temp\firecracker\client"

Open API description file

https://raw.githubusercontent.com/firecracker-microvm/firecracker/main/src/firecracker/swagger/firecracker.yaml

Kiota Version

1.16.0

Latest Kiota version known to work for scenario above?(Not required)

No response

Known Workarounds

No response

Configuration

No response

Debug output

Click to expand log ```
</details>


### Other information

_No response_
@HowardvanRooijen HowardvanRooijen added status:waiting-for-triage An issue that is yet to be reviewed or assigned type:bug A broken experience labels Jul 10, 2024
@github-project-automation github-project-automation bot moved this to Needs Triage 🔍 in Kiota Jul 10, 2024
@msgraph-bot msgraph-bot bot added the Csharp Pull requests that update .net code label Jul 10, 2024
@baywet
Copy link
Member

baywet commented Jul 10, 2024

Hi @HowardvanRooijen
Thanks for using kiota and for reaching out.
What happens if you move the attribute below the doc comment?
What happens if you remove the attribute all together?

@baywet baywet added status:waiting-for-author-feedback Issue that we've responded but needs author feedback to close and removed status:waiting-for-triage An issue that is yet to be reviewed or assigned labels Jul 10, 2024
@baywet baywet moved this from Needs Triage 🔍 to Todo 📃 in Kiota Jul 10, 2024
@baywet baywet added this to the Kiota v1.17 milestone Jul 10, 2024
@HowardvanRooijen
Copy link
Author

If you move the attribute below the comment

    /// <summary>
    /// The CPU Template defines a set of flags to be disabled from the microvm so that the features exposed to the guest are the same as in the selected instance type. This parameter has been deprecated and it will be removed in future Firecracker release.
    /// </summary>
    [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.16.0")]
    public enum CpuTemplate
    {

It compiles.

This is how all class types are generated:

    /// <summary>
    /// Balloon device descriptor.
    /// </summary>
    [global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.16.0")]
    public partial class Balloon : IAdditionalDataHolder, IParsable
    {

So I think it's something specific about how you're handling enum differently than class

@microsoft-github-policy-service microsoft-github-policy-service bot added Needs: Attention 👋 and removed status:waiting-for-author-feedback Issue that we've responded but needs author feedback to close labels Jul 10, 2024
@baywet
Copy link
Member

baywet commented Jul 10, 2024

Thanks for confirming the issue here.
Here is where this gets written.
Would you be willing to submit a pull request to address this issue?
https://github.com/microsoft/kiota/blob/main/src%2FKiota.Builder%2FWriters%2FCSharp%2FCodeEnumWriter.cs#L34

@baywet baywet added status:waiting-for-author-feedback Issue that we've responded but needs author feedback to close and removed Needs: Attention 👋 labels Jul 10, 2024
Copy link
Contributor

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Csharp Pull requests that update .net code type:bug A broken experience
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants