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

build_runner produces Severe Error - Null check operator used on a null value #46118

Closed
PuffPastry opened this issue May 23, 2021 · 3 comments
Closed
Labels
analyzer-package Issues related to package:analyzer area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion.

Comments

@PuffPastry
Copy link

Hi all,

I have been searching for a few hours now and am not able to solve the error. It is kind of a problem related to flutter, but the producing command is flutter pub run build_runner build, which I think is this repo.

The app is still compiling and tests are still passing, even after running dart pub upgrade --nullsafety for all packages except one. The problem occurs after I have added moor and am required to generate some code, thus using the above command.

  • Dart SDK Version (dart --version)
    Dart SDK version: 2.13.0 (stable) (Wed May 12 12:45:49 2021 +0200) on "windows_x64"

  • What package(s) from this repo you are using, and the version
    build_runner: ^2.0.3

  • What builder(s) you are using (or writing yourself). Try to give a short summary of what they do.
    moor_generator: ^4.3.0
    mockito: ^5.0.8

flutter pub run build_runner build -v

Output:

[ +54 ms] executing: [C:\flutter/] git -c log.showSignature=false log -n 1 --pretty=format:%H
[ +179 ms] Exit code 0 from: git -c log.showSignature=false log -n 1 --pretty=format:%H
[ +1 ms] b22742018b3edf16c6cadd7b76d9db5e7f9064b5
[ ] executing: [C:\flutter/] git tag --points-at b22742018b3edf16c6cadd7b76d9db5e7f9064b5
[ +180 ms] Exit code 0 from: git tag --points-at b22742018b3edf16c6cadd7b76d9db5e7f9064b5
[ ] 2.2.0
[ +4 ms] executing: [C:\flutter/] git rev-parse --abbrev-ref --symbolic @{u}
[ +153 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{u}
[ ] origin/stable
[ ] executing: [C:\flutter/] git ls-remote --get-url origin
[ +147 ms] Exit code 0 from: git ls-remote --get-url origin
[ ] https://github.com/flutter/flutter.git
[ +222 ms] executing: [C:\flutter/] git rev-parse --abbrev-ref HEAD
[ +154 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
[ ] stable
[ +95 ms] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[ +3 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[ +54 ms] Artifact Instance of 'MaterialFonts' is not required, skipping update.
[ ] Artifact Instance of 'GradleWrapper' is not required, skipping update.
[ ] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[ ] Artifact Instance of 'FlutterSdk' is not required, skipping update.
[ ] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[ ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'FontSubsetArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'PubDependencies' is not required, skipping update.
[ +21 ms] Using C:\flutter.pub-cache for the pub cache.
[ ] executing: C:\flutter\bin\cache\dart-sdk\bin\pub.bat run build_runner build -v
[INFO] Entrypoint:Generating build script...
[INFO] Entrypoint:Generating build script completed, took 306ms

[WARNING] Bootstrap:
Invalidated precompiled build script due to missing asset graph.
[INFO] Bootstrap:Precompiling build script......
[INFO] Bootstrap:Precompiling build script... completed, took 1.1s

[INFO] BuildDefinition:Initializing inputs
[INFO] BuildDefinition:Building new asset graph...
[INFO] BuildDefinition:Building new asset graph completed, took 751ms

[INFO] BuildDefinition:Checking for unexpected pre-existing outputs....
[INFO] BuildDefinition:Checking for unexpected pre-existing outputs. completed, took 1ms

[INFO] Build:Running build...
[INFO] Heartbeat:1.0s elapsed, 3/19 actions completed.
[INFO] Heartbeat:2.1s elapsed, 3/19 actions completed.
[INFO] Heartbeat:3.2s elapsed, 3/19 actions completed.
[INFO] Heartbeat:4.2s elapsed, 9/25 actions completed.
[INFO] Heartbeat:9.9s elapsed, 12/28 actions completed.
[INFO] Heartbeat:11.0s elapsed, 36/52 actions completed.
[SEVERE] mockito:mockBuilder on lib/core/app.dart:

Null check operator used on a null value
#0 LinkedElementFactory.isLibraryUri (package:analyzer/src/summary2/linked_element_factory.dart:418:48)
dart-lang/build#1 LibraryContext.isLibraryUri (package:analyzer/src/dart/analysis/library_context.dart:95:27)
dart-lang/build#2 LibraryAnalyzer._isLibrarySource (package:analyzer/src/dart/analysis/library_analyzer.dart:511:25)
dart-lang/build#3 LibraryAnalyzer._resolveDirectives (package:analyzer/src/dart/analysis/library_analyzer.dart:552:36)
dart-lang/build#4 LibraryAnalyzer.analyzeSync (package:analyzer/src/dart/analysis/library_analyzer.dart:128:5)
dart-lang/build#5 LibraryAnalyzer.analyze (package:analyzer/src/dart/analysis/library_analyzer.dart:105:12)
dart-lang/build#6 AnalysisDriver._computeAnalysisResult. (package:analyzer/src/dart/analysis/driver.dart:1590:63)
dart-lang/build#7 PerformanceLog.run (package:analyzer/src/dart/analysis/performance_logger.dart:32:15)
dart-lang/build#8 AnalysisDriver._computeAnalysisResult (package:analyzer/src/dart/analysis/driver.dart:1565:20)
dart-lang/build#9 AnalysisDriver._computeErrors (package:analyzer/src/dart/analysis/driver.dart:1644:26)
dart-lang/build#10 AnalysisDriver.performWork (package:analyzer/src/dart/analysis/driver.dart:1266:20)
dart-lang/build#11 AnalysisDriverScheduler._run (package:analyzer/src/dart/analysis/driver.dart:2296:24)

package:analyzer/src/dart/analysis/driver.dart 1619:9 AnalysisDriver._computeAnalysisResult.
package:analyzer/src/dart/analysis/performance_logger.dart 32:15 PerformanceLog.run
package:analyzer/src/dart/analysis/driver.dart 1565:20 AnalysisDriver._computeAnalysisResult
package:analyzer/src/dart/analysis/driver.dart 1644:26 AnalysisDriver._computeErrors
package:analyzer/src/dart/analysis/driver.dart 1266:20 AnalysisDriver.performWork
package:analyzer/src/dart/analysis/driver.dart 2296:24 AnalysisDriverScheduler._run

[INFO] Heartbeat:12.9s elapsed, 40/56 actions completed.
[INFO] Heartbeat:14.0s elapsed, 40/56 actions completed.
[INFO] Heartbeat:15.1s elapsed, 40/56 actions completed.

I have tried the command after removing mockito, but then the error appears with moor_generator, with the same stack trace.

Any and all help is greatly appreciated!

@jakemac53
Copy link
Contributor

This looks like it is happening inside the analyzer package, can you confirm you are on the latest version of that (1.5.0)? I know that some similar issues have been fixed.

@PuffPastry
Copy link
Author

Yes, I am. From pubspec.lock:

analyzer:
dependency: transitive
description:
name: analyzer
url: "https://pub.dartlang.org"
source: hosted
version: "1.5.0"
analyzer_plugin_fork:
dependency: transitive
description:
name: analyzer_plugin_fork
url: "https://pub.dartlang.org"
source: hosted
version: "0.5.1"

@jakemac53 jakemac53 transferred this issue from dart-lang/build May 24, 2021
@jakemac53 jakemac53 added analyzer-package Issues related to package:analyzer area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. labels May 24, 2021
@PuffPastry
Copy link
Author

This workaround solves it:

#46035 (comment)

Waiting on new release, as per this thread: #45823

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
analyzer-package Issues related to package:analyzer area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion.
Projects
None yet
Development

No branches or pull requests

2 participants