Skip to content

[BUG] [CSHARP] When using word Channel as part of assembly name generator produces code which could not compile #19682

@McMlok

Description

@McMlok
Description

When I generate API with csharp generator and use word Channel in packageName with library = generichost code is generated but is unable to compile. Problem is in RateLimitProvider where on line 42 is error "The type or namespace name 'CreateBounded' does not exist in the namespace 'Test.Channel' (are you missing an assembly reference?)"

openapi-generator version

I'm using version openapi-codegen-cli-7.8.0.jar

OpenAPI declaration file content or url

https://gist.github.com/McMlok/a3d8a858af888479cbbe406056042a3a

Generation Details

java.exe -jar .\openapi-generator-cli.jar generate -i '.\channel-repro.yaml' -g csharp -o .\test\ --additional-properties='library=generichost,targetFramework=net8.0,excludeTests=true,nullableReferenceTypes=true,useOneOfDiscriminatorLookup=true,packageName=Test.Channel.Client'

Steps to reproduce

Run generator

java.exe -jar .\openapi-generator-cli.jar generate -i '.\channel-repro.yaml' -g csharp -o .\test\ --additional-properties='library=generichost,targetFramework=net8.0,excludeTests=true,nullableReferenceTypes=true,useOneOfDiscriminatorLookup=true,packageName=Test.Channel.Client'
Suggest a fix

Add on line 42 before Channel System.Threading.Channels. or add word 'Channel' to reserved

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions