swagger-api / swagger-api/swagger-codegen

[csharp] XML comments include "--" and "-" erroneously

Open
#10,357 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Description

When building with -l csharp the resulting .csproj files contain illegal XML comments.

The error reported by Visual Studio is
The project file could not be loaded. An XML comment cannot contain '--', and '-' cannot be the last character.

Swagger-codegen version

2.4.14

Swagger declaration file content or url

Internal v2 docs.yaml (can't share file, but if something specific is needed informationally, let me know)

Command line used for generation

java -jar swagger-codegen-cli.jar generate -i $WORKPATH/apidocs/docs.yaml -l csharp

Steps to reproduce

(Using WSL2 with Ubuntu 20.04LTS on Windows 10)
Run above command line in and try to open resulting sln file in Visual Studio

Related issues/PRs

Seems to be duplicate of 3354, but that was closed a long time ago so might be a different cause now.

Suggest a fix/enhancement

It looks like the escaping is not working correctly. I'm not sure what needs to be fixed to get it to work properly.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with the documented Java command and the available Swagger declaration. Inspect the generated .csproj comments for the illegal '--' or trailing '-' sequences, then verify that the generated solution opens successfully in Visual Studio without the XML parsing error.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, java
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.