question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Generating TS files hangs?

See original GitHub issue

When i try to generate my TypeScript files NSwag just hangs for minutes, happens both with the cli and gui. config:

{
  "runtime": "NetCore21",
  "defaultVariables": null,
  "swaggerGenerator": {
    "webApiToSwagger": {
      "controllerNames": [
        "SelfService.Controllers.AccountController",
        "SelfService.Controllers.OrdersController"
      ],
      "isAspNetCore": true,
      "resolveJsonOptions": true,
      "defaultUrlTemplate": "api/{controller}/{id?}",
      "addMissingPathParameters": false,
      "defaultPropertyNameHandling": "Default",
      "defaultReferenceTypeNullHandling": "Null",
      "defaultEnumHandling": "String",
      "flattenInheritanceHierarchy": false,
      "generateKnownTypes": true,
      "generateXmlObjects": false,
      "generateAbstractProperties": false,
      "ignoreObsoleteProperties": false,
      "allowReferencesWithProperties": false,
      "excludedTypeNames": [],
      "serviceHost": null,
      "serviceBasePath": null,
      "serviceSchemes": [],
      "infoTitle": "Self-Service API",
      "infoDescription": "A simple ASP.NET Core Self-Service API",
      "infoVersion": "v1",
      "includedVersions": null,
      "documentTemplate": null,
      "documentProcessorTypes": [],
      "operationProcessorTypes": [],
      "typeNameGeneratorType": null,
      "schemaNameGeneratorType": null,
      "contractResolverType": null,
      "serializerSettingsType": null,
      "useDocumentProvider": false,
      "startupType": null,
      "output": null,
      "outputType": "Swagger2",
      "assemblyPaths": [
        "SelfService/bin/Debug/netcoreapp2.1/SelfService.dll"
      ],
      "assemblyConfig": null,
      "referencePaths": [
        "%USERPROFILE%/.nuget/packages"
      ],
      "useNuGetCache": true
    }
  },
  "codeGenerators": {
    "swaggerToTypeScriptClient": {
      "className": "{controller}Client",
      "moduleName": "",
      "namespace": "",
      "typeScriptVersion": 2.7,
      "template": "Angular",
      "promiseType": "Promise",
      "httpClass": "HttpClient",
      "useSingletonProvider": true,
      "injectionTokenType": "OpaqueToken",
      "rxJsVersion": 6.0,
      "dateTimeType": "MomentJS",
      "nullValue": "Null",
      "generateClientClasses": false,
      "generateClientInterfaces": false,
      "generateOptionalParameters": false,
      "exportTypes": true,
      "wrapDtoExceptions": false,
      "clientBaseClass": null,
      "wrapResponses": false,
      "wrapResponseMethods": [],
      "generateResponseClasses": true,
      "responseClass": "SwaggerResponse",
      "protectedMethods": [],
      "configurationClass": null,
      "useTransformOptionsMethod": false,
      "useTransformResultMethod": false,
      "generateDtoTypes": true,
      "operationGenerationMode": "MultipleClientsFromOperationId",
      "markOptionalProperties": true,
      "generateCloneMethod": false,
      "typeStyle": "Class",
      "classTypes": [],
      "extendedClasses": [],
      "extensionCode": null,
      "generateDefaultValues": true,
      "excludedTypeNames": [],
      "handleReferences": false,
      "generateConstructorInterface": false,
      "convertConstructorInterfaceData": false,
      "importRequiredTypes": true,
      "useGetBaseUrlMethod": false,
      "baseUrlTokenName": "API_BASE_URL",
      "queryNullValue": "",
      "templateDirectory": null,
      "typeNameGeneratorType": null,
      "propertyNameGeneratorType": null,
      "enumNameGeneratorType": null,
      "serviceHost": null,
      "serviceSchemes": null,
      "output": "SelfService/ClientApp/src/app/modules/models-response/models-response.ts"
    }
  }
}

output:

nswag run /runtime:NetCore21
NSwag NPM CLI
NSwag command line tool for .NET Core NetCore21, toolchain v11.19.0.0 (NJsonSchema v9.10.72.0 (Newtonsoft.Json v9.0.0.0))
Visit http://NSwag.org for more information.
NSwag bin directory: C:\Users\...\AppData\Roaming\npm\node_modules\nswag\bin\binaries\NetCore21

Executing file 'C:\Users\...\api.nswag'...

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
Peter-Optiwaycommented, Sep 7, 2018

I have stripped all code out of the project that i could manage, and it still yields the same error! New folder.zip

1reaction
RicoSutercommented, Sep 6, 2018

Here one of both is redundant and may slow down… also using the nuget cache makes it much slower in general

      "referencePaths": [
        "%USERPROFILE%/.nuget/packages"
      ],
      "useNuGetCache": true
Read more comments on GitHub >

github_iconTop Results From Across the Web

Windows Explorer hangs creating thumbnails for ...
ts (typescript) files, Windows Explorer hangs for several seconds attempting to generate thumbnails for each file. How can I turn this off?
Read more >
Typescript compilation speed - trying to workaround but ...
So far, I have been using tsc in a Makefile, invoking it with the "tsc --out ..." syntax, that generates a single .js...
Read more >
Freezes in TypeScript projects because of slow tsservice ...
I'm working in a project with JS and TS. It has reached a point where it's almost impossible to work without a 10-30...
Read more >
Windows 10 "hanging" when selecting large .ts (transport ...
Select a large TS file and the system hangs, the spinning circle icon appears, widow dims white, "(not responding)" displayed in the window ......
Read more >
Visual studio stops compiling TS files when the installed ...
Visual studio stops compiling TS files when the installed version of TypeScript is newer than the project specified version. - Developer Community.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found