Skip to content

The given key 'insertFinalNewline' was not present in the dictionary #411

@shenglol

Description

@shenglol

Got this error when requesting document formatting with no insertFinalNewline set in FormattingOptions:

Internal Error - System.Collections.Generic.KeyNotFoundException: The given key 'insertFinalNewline' was not present in the dictionary.

According to the LSP docs trimTrailingWhitespace, insertFinalNewline and trimFinalNewlines are optional, however it seems the OmniSharp implementation just assumes they are always in the dictionary? Should we check their existence before accessing the keys?

get => this["trimTrailingWhitespace"].IsBool ? this["trimTrailingWhitespace"].Bool : false;

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions