This is a regression in 0.12.0, and clearly isn't handled by any existing tests.
I removed a layer of lazy { ... } from the by tangleViewModel delegate, making this:
public inline fun <reified VM : ViewModel> Fragment.tangleViewModel(): Lazy<VM> {
// this is done eagerly
val viewModelFactory = TangleViewModelFactory(
owner = this,
defaultArgs = arguments,
defaultFactory = defaultViewModelProviderFactory
)
// still Lazy
return ViewModelLazy(VM::class, { viewModelStore }, { viewModelFactory })
}
The actual ViewModel being returned is still lazy, but the eager piece of code is being executed before the Fragment is attached, which causes a crash.