AliSoftware / AliSoftware/Dip

Inconsistent Crash while resolving

オープン
#227 コメント 4 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Swift
スター
982
フォーク
72
PR マージ指標
30日以内にマージされた PR はありません

説明

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 https://github.com/AliSoftware/Dip/blob/0193aa6bf6151f7ecd88ff26dba6c0525c3eabd6/Sources/AutoInjection.swift#L48

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
```

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.

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。