Open Closed

nswag error in .NET Core 3.1 #8719

nperdikis created


I am using .NET Core 3.1 & Angular 8. I am facing an issue when running refresh.bat. It's throwing me below mentioned error Executing file '..\EMA.Web.Host\nswag\service.config.nswag' with variables ''... Stack overflow. child_process.js:656 throw err; ^ As I noticed, the nswag version is 13.0.6 which does not support .NET Core 3.1 I believe. Even though I updated nswag ver to latest, its still throwing me the same error. I tried to modify few values in service.config.nswag to support core 3.1 but even then its not generating proxy file.

Also, I have changed port number (22742) to just verify but no luck. When I run 'http://localhost:22742/swagger/v1/swagger.json', I am getting updated json.

Kindly let me kow if I have missed any configuration or doing anything wrong

6 Answer(s)
  • 0
    maliming created
    Support Team

    It's throwing me below mentioned error

    Can you share the full error message?

    I remember that nswag requires the runtime of net core 2.x.

    http://localhost:22742/swagger/v1/swagger.json Can this endpoint return json data?

  • 0
    nperdikis created
    Executing file '..\src\EMA.Web.Host\nswag\service.config.nswag' with variables ''...
    Stack overflow.
        throw err;
    Error: Command failed: dotnet "..\src\EMA.Web.Host\node_modules\nswag\bin/binaries/NetCore31/dotnet-nswag.dll" run
        at checkExecSyncError (child_process.js:616:11)
        at Object.execSync (child_process.js:653:13)
        at c.exec (C:\Nithin\Projects\Devensoft\NextGen\main-trunk\src\EMA.Web.Host\node_modules\nswag\bin\nswag.js:69:11)
        at ChildProcess.exithandler (child_process.js:285:7)
        at ChildProcess.emit (events.js:189:13)
        at maybeClose (internal/child_process.js:970:16)
        at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)

    Kindly note that I have manually changed defaultCoreVersion in nswag.js to "31" as I wanted to check. Even then it was throwing error

    Can this endpoint return json data?


  • 0
    maliming created
    Support Team

    I installed the runtime of net core 2.2 on my computer. Nswag has not changed anything. It does not reproduce your problem.

    angular\nswag>"..\node_modules\.bin\nswag" run
    NSwag NPM CLI
    NSwag command line tool for .NET Core NetCore21, toolchain v13.0.6.0 (NJsonSchema v10.0.23.0 (Newtonsoft.Json v11.0.0.0))
    Visit for more information.
    NSwag bin directory: D:\Github\volo\aspnet-zero-core\angular\node_modules\nswag\bin\binaries\NetCore21
    Executing file 'D:\Github\volo\aspnet-zero-core\angular\nswag\service.config.nswag' with variables ''...
    Duration: 00:00:04.1264278

    dotnet --info

    angular\nswag>dotnet --info
    .NET Core SDK (reflecting any global.json):
     Version:   3.1.102
     Commit:    573d158fea
    Runtime Environment:
     OS Name:     Windows
     OS Version:  10.0.19041
     OS Platform: Windows
     RID:         win10-x64
     Base Path:   C:\Program Files\dotnet\sdk\3.1.102\
    Host (useful for support):
      Version: 3.1.2
      Commit:  916b5cba26
    .NET Core SDKs installed:
      2.2.207 [C:\Program Files\dotnet\sdk]
      3.1.102 [C:\Program Files\dotnet\sdk]
    .NET Core runtimes installed:
      Microsoft.AspNetCore.All 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
      Microsoft.AspNetCore.App 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
      Microsoft.AspNetCore.App 3.1.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
      Microsoft.NETCore.App 2.1.16 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
      Microsoft.NETCore.App 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
      Microsoft.NETCore.App 3.1.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
      Microsoft.WindowsDesktop.App 3.1.2 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
    To install additional .NET Core runtimes or SDKs:
  • 0
    ismcagdas created
    Support Team

    Hi @nperdikis

    Could you remove your node_modules folder and install packages again ? If that doesn't work, we can try to help you via remote connection.

  • 0
    nperdikis created


    As I noticed, it was one of our merged code which was causing the issue. It seems like nswag doesn't support JObject as input paramter now. Hence I was facing this issue. Anyways, thank you for your quick response.

  • 0
    ismcagdas created
    Support Team

    Thanks :)