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.

textDocument/didClose Expected to link dart:core and dart:async first

See original GitHub issue

Bad state: Expected to link dart:core and dart:async first:

from pkg/analyzer/lib/src/summary2/linked_element_factory.dart

An error occurred while handling textDocument/didClose notification

!! PLEASE REVIEW THIS LOG FOR SENSITIVE INFORMATION BEFORE SHARING !!

Dart Code extension: 3.27.2
Flutter extension: 3.27.0 (not activated)

App: Visual Studio Code
Remote: ssh-remote
Version: 1.61.1
Platform: linux

Workspace type: Dart
Analyzer type: LSP
Multi-root?: false

Dart SDK:
    Loc: /usr/local/google/home/dacoharkes/dart-sdk/sdk/out/ReleaseX64/dart-sdk
    Ver: 2.15.0-edge.1572894a8558ad3d3d85c08b9eb6843a940614de
Flutter SDK:
    Loc: /usr/local/google/home/dacoharkes/flt/flutter
    Ver: 2.6.0-12.0.pre.173

HTTP_PROXY: undefined
NO_PROXY: undefined

Logging Categories:
    General, Analyzer, CommandProcesses

Wed Oct 20 2021 [08:07:27 GMT+0000 (Coordinated Universal Time)] Log file started
[8:07:28 AM] [Analyzer] [Info] ==> Content-Length: 239
[8:07:28 AM] [Analyzer] [Info] ==> {"jsonrpc":"2.0","id":445,"method":"textDocument/definition","params":{"textDocument":{"uri":"file:///usr/local/google/home/dacoharkes/dart-sdk/sdk/pkg/vm/lib/transformations/ffi/definitions.dart"},"position":{"line":1498,"character":62}}}
[8:07:28 AM] [Analyzer] [Info] <== Content-Length: 422
Content-Type: application/vscode-jsonrpc; charset=utf-8

{"id":445,"jsonrpc":"2.0","result":[{"originSelectionRange":{"start":{"line":1498,"character":61},"end":{"line":1498,"character":64}},"targetUri":"file:///usr/local/google/home/dacoharkes/dart-sdk/sdk/out/ReleaseX64/dart-sdk/lib/core/int.dart","targetRange":{"start":{"line":22,"character":0},"end":{"line":336,"character":1}},"targetSelectionRange":{"start":{"line":22,"character":15},"end":{"line":22,"character":18}}}]}
[8:07:28 AM] [Analyzer] [Info] ==> Content-Length: 13317
[8:07:28 AM] [Analyzer] [Info] ==> {"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"file:///usr/local/google/home/dacoharkes/dart-sdk/sdk/out/ReleaseX64/dart-sdk/lib/core/int.dart","languageId":"dart","version":1,"text":"// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file\n// for details. All rights reserved. Use of this source code is governed by a\n// BSD-style license that can be found in the LICENSE file.\n\npart of dart.core;\n\n/// An integer number.\n///\n/// The default implementation of `int` is 64-bit two's complement integers\n/// with operations that wrap to that range on overflow.\n///\n/// **Note:** When compiling to JavaScript, integers are restricted to values\n/// that can be represented exactly by double-precision floating point values.\n/// The available integer values include all integers between -2^53 and 2^53,\n/// and some integers with larger magnitude. That includes some integers larger\n/// than 2^63.\n/// The behavior of the operators and methods in the [int]\n/// class therefore sometimes differs between the Dart VM and Dart code\n/// compiled to JavaScript. For example, the bitwise operators truncate their\n/// operands to 32-bit integers when compiled to JavaScript.\n///\n/// Classes cannot extend, implement, or mix in `int`.\nabstract class int extends num {\n  /// Returns the integer value of the given environment declaration [name].\n  ///\n  /// The result is the same as would be returned by:\n  /// ```dart template:expression\n  /// int.tryParse(const String.fromEnvironment(name, defaultValue: \"\"))\n  ///     ?? defaultValue\n  /// ```\n  /// Example:\n  /// ```dart\n  /// const int.fromEnvironment(\"defaultPort\", defaultValue: 80)\n  /// ```\n  ///\n  /// The string value, or lack of a value, associated with a [name]\n  /// must be consistent across all calls to [String.fromEnvironment],\n  /// `int.fromEnvironment`, [bool.fromEnvironment] and [bool.hasEnvironment]\n  /// in a single program.\n  ///\…
[8:07:28 AM] [Analyzer] [Info] ==> Content-Length: 182
[8:07:28 AM] [Analyzer] [Info] ==> {"jsonrpc":"2.0","method":"textDocument/didClose","params":{"textDocument":{"uri":"file:///usr/local/google/home/dacoharkes/dart-sdk/sdk/out/ReleaseX64/dart-sdk/lib/core/int.dart"}}}
[8:07:29 AM] [Analyzer] [Info] <== Content-Length: 146
Content-Type: application/vscode-jsonrpc; charset=utf-8
[8:07:29 AM] [Analyzer] [Info] <== {"method":"window/showMessage","params":{"type":1,"message":"An error occurred while handling textDocument/didOpen notification"},"jsonrpc":"2.0"}
[8:07:29 AM] [Analyzer] [Info] <== Content-Length: 19568
Content-Type: application/vscode-jsonrpc; charset=utf-8

{"method":"window/logMessage","params":{"type":1,"message":"An error occurred while handling textDocument/didOpen notification: Bad state: Expected to link dart:core and dart:async first: [file:///usr/local/google/home/dacoharkes/dart-sdk/sdk/pkg/front_end/lib/src/base/nnbd_mode.dart, file:///usr/local/google/home/dacoharkes/dart-sdk/sdk/pkg/front_end/lib/src/api_prototype/experimental_flags.dart, file:///usr/local/google/home/dacoharkes/dart-sdk/sdk/pkg/front_end/lib/src/api_prototype/file_system.dart, file:///usr/local/google/home/dacoharkes/dart-sdk/sdk/pkg/front_end/lib/src/api_unstable/util.dart, file:///usr/local/google/home/dacoharkes/dart-sdk/sdk/pkg/front_end/lib/src/api_prototype/terminal_color_support.dart, file:///usr/local/google/home/dacoharkes/dart-sdk/sdk/pkg/front_end/lib/src/fasta/ticker.dart, file:///usr/local/google/home/dacoharkes/dart-sdk/sdk/pkg/front_end/lib/src/fasta/denylisted_classes.dart, file:///usr/local/google/home/dacoharkes/dart-sdk/sdk/pkg/front_end/lib/src/api_prototype/compiler_options.dart, file:///usr/local/google/home/dacoharkes/dart-sdk/sdk/pkg/front_end/lib/src/api_prototype/standard_file_system.dart, file:///usr/local/google/home/dacoharkes/dart-sdk/sdk/pkg/front_end/lib/src/base/processed_options.dart, file:///usr/local/google/home/dacoharkes/dart-sdk/sdk/pkg/front_end/lib/src/compute_platform_binaries_location.dart, file:///usr/local/google/home/dacoharkes/dart-sdk/sdk/pkg/front_end/lib/src/fasta/command_line_reporting.dart, file:///usr/local/google/home/dacoharkes/dart-sdk/sdk/pkg/front_end/lib/src/fasta/compiler_context.dart, file:///usr/local/google/home/dacoharkes/dart-sdk/sdk/pkg/front_end/lib/src/fasta/crash.dart, file:///usr/local/google/home/dacoharkes/dart-sdk/sdk/pkg/front_end/lib/src/fasta/fasta_codes.dart, file:///usr/local/google/home/dacoharkes/dart-sdk/sdk/pkg/front_end/lib/src/fasta/kernel/type_labeler.dart, file:///usr/lo…
Wed Oct 20 2021 [08:07:31 GMT+0000 (Coordinated Universal Time)] Log file ended

@DanTup I’ve seen this happen a couple of times. I’m building that SDK and reloading it when DartCode detects the SDK has been updated, in cases that’s relevant. (I’m adding new APIs to dart:* libraries.)

Is this an error in how DartCode invokes the summaries? Or is it an error in the SDK?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:4
  • Comments:17 (8 by maintainers)

github_iconTop GitHub Comments

6reactions
innomaticacommented, Jul 21, 2022

In my case, it usually happens when I select a block of code and hit the Ctrl-C key. Once it happens it shows two identical errors.

6reactions
jpSimkinscommented, Feb 4, 2022

I get about 20-30 of these messages a day. Restart seems to help for about ~5mins but then I see these again. I just ignore them as they don’t seem to affect anything noticeable and my code is still being saved and working.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Could not load source 'dart:core-patch/errors_patch.dart'
and the test fails with the statement. widget_test.dart import 'dart:async'; import 'package:flutter/material.dart' ...
Read more >
Linter rules - Dart
To learn how to use a specific rule set, see the documentation for enabling and disabling linter rules. Rule types. Each rule is...
Read more >
exception handling in Dart and Flutter - Level Up Coding
An exception is an inability of an operation to fulfill its contract; An exception is an unexpected behavior. It seems that the first...
Read more >
Creating and Running Programs - Dart SDK
This file configures Dart linting rules. CHANGELOG.md. This file describes versions of the project. pubspec.yaml. This file describes project dependencies and ...
Read more >
material library Null safety - Flutter - Dart API docs
The default context menu for text selection for the current platform. AlertDialog: A Material Design alert dialog. Align: A widget that aligns its...
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