Skip to content

Anglar Language Service (vscode) crash when modify component's host property for host binding. #69106

Closed

Description

@Nness

Is this a bug report or a feature request?

  • Bug Report
  • Feature Request

Please provide the steps to reproduce the issue [Bug Report only]

I notice when add class binding in component's host property, VSCode often prompt and notify that Angular Language Service disconnected due to error. I have included error message below. It is always same error.

  • angular-corer: 21.2.13
  • anglar-cli: 21.2.11
  • angular.ng-template: 21.2.4
@Component({
  selector: 'dd-sample',
  imports: [],
  templateUrl: './sample.component.html',
  styles: '',
  host: {
    '[class.has-description]': 'itemSig().description()'  // when type this line.
  }
})

The steps to type. Of course that's not the only case.

  1. type ''.
  2. type '[]'
  3. type '[class.has-]' - language service crash.

Please provide the expected behavior vs the actual behavior you encountered [Bug Report only]

Language Service shouldn't crash.

Please provide a screenshot if possible [Bug Report only]

No response

Please provide the exception or error you saw [Bug Report only]

[Error - 12:02:41 PM] Request textDocument/codeAction failed.
  Message: Request textDocument/codeAction failed with message: Property binding must be string
  Code: -32603 
[Error - 12:02:43 PM] Request textDocument/codeAction failed.
  Message: Request textDocument/codeAction failed with message: Property binding must be string
  Code: -32603 
c:\Users\<user>\.vscode\extensions\angular.ng-template-21.2.4\node_modules\@angular\language-service\bundles\language-service.js:71064
                throw new Error(`AssertionError: Expected successfully analyzed compilation.`);
                      ^

Error: AssertionError: Expected successfully analyzed compilation.
    at IncrementalCompilation.priorTypeCheckingResultsFor (c:\Users\<user>\.vscode\extensions\angular.ng-template-21.2.4\node_modules\@angular\language-service\bundles\language-service.js:71064:23)
    at TemplateTypeCheckerImpl.maybeAdoptPriorResults (c:\Users\<user>\.vscode\extensions\angular.ng-template-21.2.4\node_modules\@angular\language-service\bundles\language-service.js:62302:57)
    at TemplateTypeCheckerImpl.ensureAllShimsForOneFile (c:\Users\<user>\.vscode\extensions\angular.ng-template-21.2.4\node_modules\@angular\language-service\bundles\language-service.js:62336:18)
    at TemplateTypeCheckerImpl.getDiagnosticsForFile (c:\Users\<user>\.vscode\extensions\angular.ng-template-21.2.4\node_modules\@angular\language-service\bundles\language-service.js:62121:26)
    at NgCompiler.getTemplateDiagnosticsForFile (c:\Users\<user>\.vscode\extensions\angular.ng-template-21.2.4\node_modules\@angular\language-service\bundles\language-service.js:77289:69)
    at NgCompiler.getDiagnosticsForFile (c:\Users\<user>\.vscode\extensions\angular.ng-template-21.2.4\node_modules\@angular\language-service\bundles\language-service.js:76786:42)
    at c:\Users\<user>\.vscode\extensions\angular.ng-template-21.2.4\node_modules\@angular\language-service\bundles\language-service.js:91536:56
    at c:\Users\<user>\.vscode\extensions\angular.ng-template-21.2.4\node_modules\@angular\language-service\bundles\language-service.js:91965:71
    at ActivePerfRecorder.inPhase (c:\Users\<user>\.vscode\extensions\angular.ng-template-21.2.4\node_modules\@angular\language-service\bundles\language-service.js:44425:24)
    at LanguageService.withCompilerAndPerfTracing (c:\Users\<user>\.vscode\extensions\angular.ng-template-21.2.4\node_modules\@angular\language-service\bundles\language-service.js:91965:50)

Node.js v22.22.1
[Error - 12:02:43 PM] Server process exited with code 1.
[Info  - 12:02:43 PM] Connection to server got closed. Server will restart.
true
[Info  - 12:02:43 PM] Angular language server process ID: 18764
[Info  - 12:02:43 PM] Imported typescript/lib/tsserverlibrary is version 5.9.3.
[Info  - 12:02:43 PM] Using @angular/language-service v21.2.14 from c:\Users\<user>\.vscode\extensions\angular.ng-template-21.2.4\node_modules\@angular\language-service\index.js
[Info  - 12:02:43 PM] Logging is turned off. To enable, run command 'Open Angular server log'.
[Info  - 12:02:50 PM] Enabling language service for c:/Projects/DeskDirector/admin-console/tsconfig.json.

Description [Feature Request only]

No response

Proposed solution [Feature Request only]

No response

Alternatives considered [Feature Request only]

No response

Activity

  1. added
    area: language-service
    on Jun 3, 2026
  2. added this to the needsTriage milestone on Jun 3, 2026
  3. Nness commented on Jun 3, 2026

    @Nness
    Author

    Even when type class: 'sample' in host will crash. I did use Tailwind service, not sure if that will cause any problem when use together.

    Image
  4. JeanMeche commented on Jun 3, 2026

    @JeanMeche
    Member

    I couldn't reproduce it on a latest v21 project. Could you check by disabling your other extensions ?

  5. Nness commented on Jun 3, 2026

    @Nness
    Author

    What if you just let Anglar Language Service running against following code? I have disabled majority of extensions, include Tailwind language service. it is still happen. And when I leave as code below, it soon hit 5 crash and completely stopped the extension.

    I know the following code is not complete, but look, unless you can type in lightning speed, there will always be case that send corrupted data. It should never crash.

    If still not happen to you, are there anyway we can check what's been sent to language service?

    @Component({
      selector: 'dd-update-task-list',
      imports: [TaskListItemsComponent],
      templateUrl: './update-task-list.component.html',
      styles: '',
      host: {
        class: 'dd-modal-component',
        '[class.]'
      },
      preserveWhitespaces: false
    })
  6. JeanMeche commented on Jun 3, 2026

    @JeanMeche
    Member

    Gotcha,

      host: {
        class: 'dd-modal-component',
        '[class.]'
      },
    

    is indeed enough to make it crash.

  7. Nness commented on Jun 3, 2026

    @Nness
    Author

    Sometime I am not type that fast, especially when thinking about what should be used with binding. Or waiting for if here is any suggestion.

  8. aparzi commented on Jun 19, 2026

    @aparzi
    Contributor

    I managed to replicate this issue as well.

    • VS Code (with Angular Language Service extension): The crash reproduces consistently when typing incomplete/malformed host bindings as described.
    • WebStorm: Interestingly, the issue does NOT seem to occur here, likely due to WebStorm's internal parsing resilience or its native Angular support handling the incomplete syntax differently before hitting the compiler assertion.
  9. added a commit that references this issue on Jun 23, 2026
    e376ee7
  10. added a commit that references this issue on Jun 24, 2026
    8b2785b
  11. added a commit that references this issue on Jun 24, 2026
    06d8549
  12. angular-automatic-lock-bot commented on Jul 25, 2026

    @angular-automatic-lock-bot

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

  13. locked and limited conversation to collaborators on Jul 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: language-service

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions