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

Inconsistent Crash while resolving #227

Open
SlashDevSlashGnoll opened this issue Oct 14, 2019 · 4 comments
Open

Inconsistent Crash while resolving #227

SlashDevSlashGnoll opened this issue Oct 14, 2019 · 4 comments

Comments

@SlashDevSlashGnoll
Copy link

We're seeing a crash in DIP when creating the initial view controller which through it's references winds up trying to resolve a type which results in a crash. This type can be described as such (using made-up names to simplify):

struct Configuration {}

protocol Foo {}

open class SuperClass: Foo {
   var configsByUser: [String: Configuration] = []
}

class SubClass: SuperClass {}

We register SubClass into the dependency container using the type Foo. When we resolve, there seems to be a crash at

guard let injectedPropertyBox = child.value as? AutoInjectedPropertyBox else { return }

In this specific case it seems to be trying to deal with the property configsByUser above. In the debugger I am able to see the following:

(lldb) po type(of: child.value)
Swift.Dictionary<Swift.String, Configuration>

It seems that the data in the Mirror is neither AutoInjectedPropertyBox nor ImplicitlyUnwrappedOptional. Accessing child.value at all seems to crash as the debugger cannot do anything with it beyond querying the type as far as I can tell. I saw https://bugs.swift.org/browse/SR-2282 that you filed but that doesn't seem to be the same issue.

I'm unsure if this shows a problem with how things are registered or what but I wasn't sure how to chase this further. Any input would be greatly appreciated as this error happens very frequently in the simulator which is destroying our automated testing. We do not think we've seen this at all on an actual device so that could be another data point.

@SlashDevSlashGnoll
Copy link
Author

Ah I should also note that we are building with Xcode 11.0 and this issue started during our conversion on the Beta this summer so it seems to be new to this version of the compiler.

@ilyapuchka
Copy link
Collaborator

ilyapuchka commented Oct 28, 2019

If you don't use autoinjected properties you can disable them until this is resolved (if it still happens with GM?). See a8777c0

@ilyapuchka
Copy link
Collaborator

@SlashDevSlashGnoll is this still relevant?

@SlashDevSlashGnoll
Copy link
Author

Turning off autoinjected properties avoids the problem for us yes. Thanks for the advice. It feels like there's still an issue in there but since we didn't need that feature we could just disable it.

Sorry for not reporting in earlier!

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

No branches or pull requests

2 participants