-
Notifications
You must be signed in to change notification settings - Fork 125
Crash: Null check operator used on a null value #4021
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
Comments
That's funny that you have a |
My best guess is that on GitLab, the code-generation step has not been run yet. dartdoc is looking for an imported library and not finding it. |
I'm not exactly sure what you mean. I do not have any "prefix" in my codebase, besides some Thank you for having a look on my issue! Is there an easy way for me to test the fix in your MR? |
Oh I thought the code you showed, with |
You can run |
Is it OK if I continue the discussion here, despite the closed issue? I've tried the commit f41bd3a from main: $ dart pub global activate --source git https://github.com/dart-lang/dartdoc/ --git-ref f41bd3ab4bd34c048f2c803174f16bc128acadaa
Resolving dependencies...
Downloading packages...
+ _fe_analyzer_shared 80.0.0
+ analyzer 7.3.0
+ args 2.7.0
+ async 2.13.0
+ collection 1.19.1
+ convert 3.1.2
+ crypto 3.0.6
+ csslib 1.0.2
+ dartdoc 8.3.3 from git https://github.com/dart-lang/dartdoc/ at f41bd3
+ file 7.0.1
+ glob 2.1.3
+ html 0.15.5
+ logging 1.3.0
+ markdown 7.3.0
+ meta 1.16.0
+ package_config 2.2.0
+ path 1.9.1
+ pub_semver 2.2.0
+ source_span 1.10.1
+ string_scanner 1.4.1
+ term_glyph 1.2.2
+ typed_data 1.4.0
+ watcher 1.1.1
+ yaml 3.1.3
Building package executables...
Built dartdoc:dartdoc.
Installed executable dartdoc.
Activated dartdoc 8.3.3 from Git repository "https://github.com/dart-lang/dartdoc/".
$ dartdoc
Documenting app...
Discovering libraries...
Linking elements...
Precaching local docs for 152133 elements...
Initialized dartdoc with 378 libraries
[...snip...]
Generating docs for library data/dao/app_database_dao.dart from file:///builds/app/lib/data/dao/app_database_dao.dart...
dartdoc 8.3.3 (/root/.pub-cache/global_packages/dartdoc/bin/dartdoc.dart-3.7.0.snapshot) failed: Bad state: Unexpected null LibraryElement2 for imported library at Instance of 'DirectiveUriWithRelativeUriImpl'
#0 Prefix._importedLibraryElement (package:dartdoc/src/model/prefix.dart:39:7)
#1 Prefix.associatedLibrary (package:dartdoc/src/model/prefix.dart:29:26)
#2 Prefix.associatedLibrary (package:dartdoc/src/model/prefix.dart)
#3 Prefix.canonicalModelElement (package:dartdoc/src/model/prefix.dart:47:41)
#4 Prefix.href (package:dartdoc/src/model/prefix.dart:56:23)
#5 PackageGraph.allHrefs (package:dartdoc/src/model/package_graph.dart:599:33)
#6 new Validator (package:dartdoc/src/validator.dart:38:32)
#7 Dartdoc.generateDocsBase (package:dartdoc/src/dartdoc.dart:209:7)
<asynchronous suspension>
#8 Dartdoc.generateDocs (package:dartdoc/src/dartdoc.dart:241:24)
<asynchronous suspension>
#9 Dartdoc.executeGuarded.<anonymous closure> (package:dartdoc/src/dartdoc.dart:273:9)
<asynchronous suspension> Unfortunately, the doc still cannot be generated. |
The change I made will not allow any new docs to be generated. It's just debugging info. My best guess is that on GitLab, the code-generation step has not been run yet. dartdoc is looking for an imported library and not finding it. |
Thanks you. I've noticed that the problem appears locally when running |
When running
dartdoc
on our application, we get the following failure:Link to prefix.dart:30 as of today.
I do not know whether it's linked to the last file read. In case it is, here is the code:
When checking since when it fails in our pipeline, I do not see anything special in the corresponding commit: only changes in the Dart code, few annotations used (
@Freezed(toStringOverride
), but nothing related to the tooling.For context, it's running in a Linux gitlab worker, using the
flutter:3.27.1
container from CirrusLabs up toflutter:3.29.1
. The setup runsdart pub global activate dartdoc
(which ends withActivated dartdoc 8.3.3
, and the command isdartdoc
.I tried to replicate it locally (with Flutter 3.29.1 on macOS), and the doc generation works correctly, without a crash.
The text was updated successfully, but these errors were encountered: