johnno1962 / InjectionIII

Re-write of Injection for Xcode in (mostly) Swift
MIT License
4.08k stars 319 forks source link

TCA ObservableState crash #499

Closed kuglee closed 7 months ago

kuglee commented 7 months ago

I've run into an another crash when using TCA with ObservableState. Steps to reproduce:

  1. Clone the example project: InjectTCATest
  2. Start the app
  3. Press the Increment button
  4. Change the ChildFeature text in ChildFeature.swift
  5. Press the Increment button

Log:

💉 InjectionIII connected /Users/kuglee/Downloads/InjectTCATest/InjectTCATest.xcodeproj
💉 Watching files under the directory /Users/kuglee/Downloads/InjectTCATest
💉 Compiling /Users/kuglee/Downloads/InjectTCATest/InjectTCATest/ChildFeature.swift
💉 Loading .dylib ...
💉 Interposed 13 function references.
💉 Injected type #1 'InjectTCATest.ChildFeature'
💉 Injected type #2 'InjectTCATest.ChildFeature.State'
💉 Injected type #3 'InjectTCATest.ChildFeature.Action'
💉 Injected type #4 'InjectTCATest.ChildFeature.Action.AllCasePaths'
💉 Injected type #5 'InjectTCATest.ChildView'
💉 Recycling closure #1 () -> SwiftUI.TupleView, SwiftUI.Text, InjectTCATest.ChildView)> in InjectTCATest.AppView.body.getter : some.keyPath#0
💉 Recycling closure #1 () -> SwiftUI.TupleView, SwiftUI.Text, InjectTCATest.ChildView)> in InjectTCATest.AppView.body.getter : some.keyPath#1
💉 Recycling closure #1 () -> SwiftUI.TupleView, SwiftUI.Text, InjectTCATest.ChildView)> in InjectTCATest.AppView.body.getter : some.keyPath#2
💉 Recycling closure #1 () -> SwiftUI.TupleView, SwiftUI.Text, InjectTCATest.ChildView)> in InjectTCATest.AppView.body.getter : some.keyPath#3
💉 Recycling closure #1 () -> SwiftUI.TupleView, SwiftUI.Text, InjectTCATest.ChildView)> in InjectTCATest.AppView.body.getter : some.keyPath#4
💉 Recycling closure #1 () -> SwiftUI.TupleView, SwiftUI.Text, InjectTCATest.ChildView)> in InjectTCATest.AppView.body.getter : some.keyPath#5
💉 Recycling InjectTCATest.AppFeature.body.getter : some.keyPath#0
💉 Recycling InjectTCATest.AppFeature.body.getter : some.keyPath#1
💉 Recycling InjectTCATest.AppFeature.body.getter : some.keyPath#2
💉 Recycling closure #2 (inout InjectTCATest.AppFeature.State, InjectTCATest.AppFeature.Action) -> ComposableArchitecture.Effect in InjectTCATest.AppFeature.body.getter : some.keyPath#0
💉 Recycling closure #2 (inout InjectTCATest.AppFeature.State, InjectTCATest.AppFeature.Action) -> ComposableArchitecture.Effect in InjectTCATest.AppFeature.body.getter : some.keyPath#1
💉 Recycling closure #1 () -> () in closure #1 () -> SwiftUI.TupleView, SwiftUI.Text, InjectTCATest.ChildView)> in InjectTCATest.AppView.body.getter : some.keyPath#0
💉 Recycling closure #1 () -> SwiftUI.TupleView, SwiftUI.Text, InjectTCATest.ChildView)> in InjectTCATest.AppView.body.getter : some.keyPath#6
💉 Recycling closure #1 () -> SwiftUI.TupleView, SwiftUI.Text, InjectTCATest.ChildView)> in InjectTCATest.AppView.body.getter : some.keyPath#7
xcode
kuglee commented 7 months ago

I've also noticed If I change the ChildFeature text in ChildFeature.swift before Incrementing, then the count is some random value (uninitialised memory?) instead of 1:

wrong count
johnno1962 commented 7 months ago

Can you try the new release candidate I uploaded yesterday please (build 8040) as I couldn't replicate the problem with your test project and much has changed since the last version.

kuglee commented 7 months ago

That version is working great. Thanks 🙏.