Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Analysis server fails to initialize/create contexts with an invalid entry in lint rules #55594

Open
DanTup opened this issue Apr 29, 2024 · 0 comments
Labels
analyzer-analysis-options analyzer-stability area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. crash Process exits with SIGSEGV, SIGABRT, etc. An unhandled exception is not a crash. P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@DanTup
Copy link
Collaborator

DanTup commented Apr 29, 2024

I had this in my analysis_options.yaml (note the blank entry at the end):

linter:
  rules:
    - camel_case_types
    - file_names
    - non_constant_identifier_names
    - comment_references
    -

It caused the server to fail to create analysis roots during initialization:

1714403559225:Ex:An error occurred while handling initialized notification
type 'Null' is not a subtype of type 'Object' in type cast
#0      YamlNodeExtension.valueOrThrow (package::analyzer/src/util/yaml.dart::147::36)
#1      _LintConfig.asString (package::analyzer/src/lint/config.dart::93::47)
#2      _LintConfig._parseYaml.<anonymous closure> (package::analyzer/src/lint/config.dart::136::29)
#3      _LinkedHashMapMixin.forEach (dart::collection-patch/compact_hash.dart::633::13)
#4      MapView.forEach (dart::collection/maps.dart::347::10)
#5      _LintConfig._parseYaml (package::analyzer/src/lint/config.dart::117::16)
#6      new LintConfig.parseMap (package::analyzer/src/lint/config.dart::38::62)
#7      parseConfig (package::analyzer/src/lint/config.dart::15::25)
#8      AnalysisOptionsImplExtensions.applyOptions (package::analyzer/src/analysis_options/apply_options.dart::229::18)
#9      ContextBuilderImpl._createOptionsMap (package::analyzer/src/dart/analysis/context_builder.dart::210::15)
#10     ContextBuilderImpl.createContext (package::analyzer/src/dart/analysis/context_builder.dart::135::15)
#11     new AnalysisContextCollectionImpl (package::analyzer/src/dart/analysis/analysis_context_collection.dart::104::36)
#12     ContextManagerImpl._createAnalysisContexts.performContextRebuildGuarded.performContextRebuild (package::analysis_server/src/context_manager.dart::547::40)
<asynchronous suspension>
#13     ContextManagerImpl._createAnalysisContexts.performContextRebuildGuarded (package::analysis_server/src/context_manager.dart::697::11)
<asynchronous suspension>
#14     _CancellingTaskQueue.queue.<anonymous closure> (package::analysis_server/src/context_manager.dart::981::15)
<asynchronous suspension>
#15     ContextManagerImpl.setRoots (package::analysis_server/src/context_manager.dart::363::5)
<asynchronous suspension>
#16     LspAnalysisServer._refreshAnalysisRoots (package::analysis_server/src/lsp/lsp_analysis_server.dart::1072::9)
<asynchronous suspension>
#17     LspAnalysisServer.updateWorkspaceFolders (package::analysis_server/src/lsp/lsp_analysis_server.dart::940::5)
<asynchronous suspension>

This seems like an error that should be non-fatal.

@DanTup DanTup added the area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. label Apr 29, 2024
@bwilkerson bwilkerson added P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) labels Apr 29, 2024
@DanTup DanTup added the crash Process exits with SIGSEGV, SIGABRT, etc. An unhandled exception is not a crash. label Aug 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
analyzer-analysis-options analyzer-stability area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. crash Process exits with SIGSEGV, SIGABRT, etc. An unhandled exception is not a crash. P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

3 participants