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

Riverpod Generator Stack Overflow #2798

Closed
dario-digregorio opened this issue Aug 5, 2023 · 5 comments
Closed

Riverpod Generator Stack Overflow #2798

dario-digregorio opened this issue Aug 5, 2023 · 5 comments
Assignees
Labels
bug Something isn't working question Further information is requested

Comments

@dario-digregorio
Copy link

Describe the bug
When running dart build_runner watch -d --use-polling-watcher I get errors.

Executing task: C:\flutter\bin\cache\dart-sdk\bin\dart.exe run build_runner watch -d  --use-polling-watcher 

[INFO] Generating build script completed, took 321ms
[INFO] Setting up file watchers completed, took 11ms
[INFO] Waiting for all file watchers to be ready completed, took 512ms
[INFO] Reading cached asset graph completed, took 210ms
[INFO] Checking for updates since last build completed, took 866ms
[INFO] Running build completed, took 37ms
[INFO] Caching finalized dependency graph completed, took 129ms
[SEVERE] riverpod_generator on lib/app/state/animation.viewmodel.dart (cached):

Stack Overflow
[SEVERE] riverpod_generator on lib/app/state/places_view.viewmodel.dart (cached):

Stack Overflow
[SEVERE] riverpod_generator on lib/app/state/selected.viewmodel.dart (cached):

Stack Overflow
[SEVERE] Failed after 178ms

To Reproduce
I have a lot of generative actions: [INFO] Succeeded after 28.1s with 61 outputs (1152 actions)
I noticed the more actions I have the more often I get this error. The only way to fix it is to clean the cache dart run build_runner clean and to rerun the build.

Expected behavior
The build should at least try to delete the cache or parts of the cache and rerun the build. Otherwise I only get the error and have to delete the cache manually

@rrousselGit
Copy link
Owner

Please provide a way to reproduce the issue.

@rrousselGit
Copy link
Owner

@dario-digregorio Could you try running dart run build_runner build -d -v? This should give you a stacktrace, which I will need

@dario-digregorio
Copy link
Author

Hi, here is the stacktrace:

I deleted the allPurchasedProductIdentifiersProvider and I can see that the builder uses the cached file. It does not matter if I change anything in the file, it still will use the old cached version. At least when I use watch. Sometimes changing the file a few times works. But sometimes it doesn't. The only solution that always works is to use dart run build_runner clean.

 dart run build_runner build -d -v
[INFO] Entrypoint:Generating build script...
[INFO] Entrypoint:Generating build script completed, took 190ms

[INFO] BuildDefinition:Initializing inputs
[INFO] BuildDefinition:Reading cached asset graph...
[INFO] BuildDefinition:Reading cached asset graph completed, took 176ms

[INFO] BuildDefinition:Checking for updates since last build...
[INFO] BuildDefinition:Checking for updates since last build completed, took 748ms

[INFO] Build:Running build...
[INFO] Build:Running build completed, took 25ms

[INFO] Build:Caching finalized dependency graph...
[INFO] Build:Caching finalized dependency graph completed, took 102ms

[SEVERE] envied_generator:envied on lib/app/state/purchases.viewmodel.dart (cached):

Could not resolve annotation for `AutoDisposeProvider<List<String>> allPurchasedProductIdentifiersProvider`.
package:source_gen/src/type_checker.dart 114:7              TypeChecker._computeConstantValue
package:source_gen/src/type_checker.dart 139:21             TypeChecker._annotationsWhere
dart:core                                                   Iterable.isEmpty
package:source_gen/src/type_checker.dart 73:20              TypeChecker.firstAnnotationOf
package:source_gen/src/library.dart 51:34                   LibraryReader.annotatedWith
dart:async                                                  _SyncStarIterator.moveNext
package:source_gen/src/generator_for_annotation.dart 52:42  GeneratorForAnnotation.generate
package:source_gen/src/builder.dart 355:33                  _generate

[SEVERE] json_serializable on lib/app/state/purchases.viewmodel.dart (cached):

Could not resolve annotation for `AutoDisposeProvider<List<String>> allPurchasedProductIdentifiersProvider`.
package:source_gen/src/type_checker.dart 114:7              TypeChecker._computeConstantValue
package:source_gen/src/type_checker.dart 139:21             TypeChecker._annotationsWhere
dart:core                                                   Iterable.isEmpty
package:source_gen/src/type_checker.dart 73:20              TypeChecker.firstAnnotationOf
package:source_gen/src/library.dart 51:34                   LibraryReader.annotatedWith
dart:async                                                  _SyncStarIterator.moveNext
package:json_serializable/src/json_part_builder.dart 59:22  _UnifiedGenerator.generate
package:source_gen/src/builder.dart 355:33                  _generate

[SEVERE] riverpod_generator on lib/app/state/purchases.viewmodel.dart (cached):

Could not resolve annotation for `AutoDisposeProvider<List<String>> allPurchasedProductIdentifiersProvider`.
package:source_gen/src/type_checker.dart 114:7             TypeChecker._computeConstantValue
package:source_gen/src/type_checker.dart 139:21            TypeChecker._annotationsWhere
dart:core                                                  Iterable.isEmpty
package:source_gen/src/type_checker.dart 95:20             TypeChecker.firstAnnotationOfExact
package:source_gen/src/library.dart 67:34                  LibraryReader.annotatedWithExact
dart:async                                                 _SyncStarIterator.moveNext
package:riverpod_generator/src/parse_generator.dart 23:37  ParserGenerator.generate
package:source_gen/src/builder.dart 355:33                 _generate

[SEVERE] freezed on lib/app/state/purchases.viewmodel.dart (cached):

Could not resolve annotation for `AutoDisposeProvider<List<String>> allPurchasedProductIdentifiersProvider`.
package:source_gen/src/type_checker.dart 114:7   TypeChecker._computeConstantValue
package:source_gen/src/type_checker.dart 139:21  TypeChecker._annotationsWhere
dart:core                                        Iterable.isEmpty
package:source_gen/src/type_checker.dart 73:20   TypeChecker.firstAnnotationOf
package:source_gen/src/type_checker.dart 80:7    TypeChecker.hasAnnotationOf
dart:_internal                                   WhereIterator.moveNext
package:freezed/src/parse_generator.dart 29:37   ParserGenerator.generate
package:source_gen/src/builder.dart 355:23       _generate

[SEVERE] Build:
Failed after 145ms

@rrousselGit
Copy link
Owner

That appears to be a completely different error, isn't it?
I don't see a stackoverflow

That specific issue was recently fixed in source_gen: dart-lang/source_gen#682
So it should go away soon enough

@dario-digregorio
Copy link
Author

That is right. I did not see this error for quiet some time. When it happens again I will reopen this issue :) Thank you for your time!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants