-
Notifications
You must be signed in to change notification settings - Fork 50
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
XMLListCollection: exception in constructor #167
Comments
Some further info. I placed a breakpoint just before the line causing the exception in both cases. In the version that works, In the broken version it looks like this: So there are a lot fewer imports happening. Is my issue that I should be importing something into the as file that i am not? |
This may be a problem with static initializers. I haven't tried, but as a workaround maybe use a getter with lazy initialization for Devices. In other words, try replacing static public var Devices:XMLListCollection=new XMLListCollection(); with static private var _Devices:XMListCollection; |
Just confirming that I able still able to reproduce this issue with the latest compiler. It does appear to be a static dependency ordering issue. I assume that the |
Yeah. This is a known problem. Currently it's only possible to reliably use native types in static initializers. Static initializers are evaluated when the JS file loads. The only way to get that to work with the current system is to ensure that the dependencies load first. There are cases where it's impossible to resolve that because you can have A which references B and B which references A. One potential solution which I mentioned in the past is to collect all non-native static initializers collected and loaded after all the other files. I think @aharui might have had a different solution. |
Test case code:
i2.mxml:
testglob.as:
When the XMLListCollection is initialised in the mxml file, everything is fine and the initialisation is successful.
When it's initialised by importing the testglob.as class, I get an exception:
On the face of it it seems a bit like the other XML bug I reported a couple of days ago, where the framework is calling an internal function that seems not to be there. So it's either never loaded (it looks as if it is) or something is treading on it. Or something else completely different.
I am running the nightly build on OSX big sur, log follows:
The text was updated successfully, but these errors were encountered: