Skip to content

Uncaught NullError: method not found: 'constructor' on null - js_helper.dart:1697 #24898

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

Closed
MikeMitterer opened this issue Nov 12, 2015 · 11 comments

Comments

@MikeMitterer
Copy link

After compiling my app to JS I get this exception/error.
The worst thing here is that I have no chance to find out where it comes from!

Here is the callstack:

dart.wrapException  @   js_helper.dart:1697
dart._rethrow   @   async_patch.dart:511
dart._rootHandleUncaughtError_closure.call$0    @   zone.dart:896
dart._AsyncCallbackEntry.callback$0 @   future_impl.dart:666
dart._microtaskLoop @   schedule_microtask.dart:43
dart._microtaskLoopEntry    @   schedule_microtask.dart:52
dart._AsyncRun__initializeScheduleImmediate_internalCallback.call$1 @   async_patch.dart:53
dart.invokeClosure_closure0.call$0  @   js_helper.dart:2373
dart._IsolateContext.eval$1 @   isolate_helper.dart:462
dart._callInIsolate @   isolate_helper.dart:54
dart.invokeClosure  @   js_helper.dart:2373
(anonymous function)    @   js_helper.dart:2397

I attache a SS so that you can see how it looks like in DevTools
(The 46 errors are just my _logger.error-messages!!!! not real errors)
screenshot-1924

@kevmoo
Copy link
Member

kevmoo commented Nov 12, 2015

@MikeMitterer you're on 1.13.0-dev.7.10 right?

@sigmundch
Copy link
Member

Could you share the code with us or a way to run the app (e.g. if you host the generated js code somewhere) so we can reproduce it and investigate more closely?

If not, one thing that could help us would be to give us a more detailed stack trace in JS. For example,
show us the full code of each frame in your stack with source-maps disabled (since the translation back to the dart sources might be off and it's especially hard to do for dart2js's internal code like js_helper.dart).

Thanks!

@MikeMitterer
Copy link
Author

@kevmoo Yes.
Its the renderString-Function https://goo.gl/9CKsWC from the mustache package.
But it's not a general problem. All the other samples are working. It's a special combination of template (<mmui-device device-id="{{device.uniqueID}}"></mmui-device>) and the item I am rendering.

Sorry I can't give you this part of the source - it's part of my internal project but tomorrow I will try to split out this part...

@MikeMitterer
Copy link
Author

OK guys - took me quite a while to separate out all the necessary files but here is the sample: http://www.mikemitterer.at/fileadmin/_temp_/jsbug.tgz

I also recorded my tests - check out this mp4: http://www.mikemitterer.at/fileadmin/_temp_/jsbug.mp4
~07:10 I start with pub build...

BTW: Today the error message is a bit different: `Uncaught Value was missing for variable tag: device.uniqueID. (1:6)

{{device.uniqueID}}
`

I'm using this SKD version today: https://goo.gl/ZMh3AF (1.13.0-dev.7.11)

My video also shows this bug: #24868 (12:02) It looks as if #24868 is my fault but as you can see it works in Chromium but fails in the JS-Version...

(The double to int cast problem is already fixed in my internal master...)

@MikeMitterer
Copy link
Author

I tried it with dart-sdk_1.13.0-dev.7.12
but it's almost the same. Error message is a bit different but it's not reproducible from where the message comes from and as said - it works in Chromium...

screenshot-1932

@MikeMitterer
Copy link
Author

I found the problem - it was an Object not marked for mirrors. But as said before - for such cases it's really hard to find the problem. It's more or less try and error - no support from DevTools or Source-Maps...

@zoechi
Copy link
Contributor

zoechi commented Nov 24, 2015

Mirrors is deprecated, isn't it? reflectable is the new way.

@sigmundch
Copy link
Member

@MikeMitterer - I'm glad you were able to find the problem, thanks for keeping us updated!

As @zoechi suggests, the ideal is to use something that can check that the object is available before we access it via mirrors. Reflectable is great for this - it declares explicitly what and how you use mirrors. It does it in a way that would prevent this kind of situations: if you can use it in dartium, it means it was included for dart2js to use as well.

Are you using mirrors directly or through a framework like polymer or angular?

@MikeMitterer
Copy link
Author

I'm using it directly. Both of you - thanks for the answer.

@MikeMitterer
Copy link
Author

@zoechi I think it's not deprecated - I think reflectable uses it internally if it runs in the VM...

@kevmoo
Copy link
Member

kevmoo commented Nov 26, 2015

@MikeMitterer dart:mirrors is strongly "discouraged" with web apps (dart2js). If you're on the VM, enjoy! 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants