Throw a more descriptive error if the metadata can't be found
If we can't read the DDC metadata file we get an odd state error:
Thread 0 main threadStateError: Bad state: No element
at List.last(growable_array.dart:255)
at AppInspector._initialize(inspector.dart:90)
at <asynchronous gap>(async)
at AppInspector.initialize(inspector.dart:155)
at <asynchronous gap>(async)
at ChromeProxyService.createIsolate(chrome_proxy_service.dart:180)
at <asynchronous gap>(async)
This is because we get an empty list of libraries. We should implement better logging here and throw a better more descriptive state error.
Hmmm. Actually it's not clear to me how we get into this state as we do throw an error if the metadata can't be read: https://github.com/dart-lang/webdev/blob/968e7eb67c3429c07d53ac2a9eba7c5d995fadc2/dwds/lib/src/debugging/metadata/provider.dart#L137
Is it possible that the metadata file is empty? I believe it is synthetically generated in Flutter Tools.
cc @jonahwilliams @annagrin
I don't really know what the metadata is used for
It's used to parse the available modules and other related DDC metadata. I think we can sit on this issue until someone reports it with a verbose trace. Hopefully that will be more enlightening.
@grouma do we have a repro to play with, or detailed logs?
This report is coming from our Flutter analytics. We don't get much more than the stack trace and platform. It's a transient issue so I don't have a repo yet.