Skip to content

Argument null exception #1157

@netpirates

Description

@netpirates

Describe the bug
While trying to generate C# file from openAPI spec it's throwing error with "System.ArgumentException: String cannot be of zero length". I see same behavior with VS 2019 and 2022 extensions. I'm using VS 2022 on Win 11.
I was able to generate code with same json spec/file earlier using OpenAPI tool which I had it installed in my Win 10 machine using VS 2019. Now I'm not able to generate the file.

Below is is my error:
Parameter name: oldValue
at System.String.ReplaceInternal(String oldValue, String newValue)
at System.String.Replace(String oldValue, String newValue)
at Rapicgen.Core.Generators.OpenApi.OpenApiCSharpCodeGenerator.GenerateCode(IProgressReporter pGenerateProgress) in D:\a\apiclientcodegen\apiclientcodegen\src\Core\ApiClientCodeGen.Core\Generators\OpenApi\OpenApiCSharpCodeGenerator.cs:line 84
at Rapicgen.CustomTool.SingleFileCodeGenerator.Generate(String wszInputFilePath, String bstrInputFileContents, String wszDefaultNamespace, IntPtr[] rgbOutputFileContents, UInt32& pcbOutput, IVsGeneratorProgress pGenerateProgress)
5/18/2025 11:08:27 PM: System.ArgumentException: String cannot be of zero length.

I'm using OpenAPI Generator(V7.13.0) in both VS 2022 and 2019.

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Visual Studio Extension (please complete the following information):

  • Visual Studio Version: [e.g. 2017, 2019, Visual Studio for Mac]
  • Extension Version [e.g. 1.2.6222]

Additional context
Add any other context about the problem here.

Metadata

Metadata

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions