Skip to content

Scoped component is being attempted to be created from root scope in 4.2.0 #2379

Description

@nikola-despotoski-gid

Describe the bug
In versions prior 4.2.0 correctly scoped components are correctly loaded from scope upon which declare was called.

In 4.2.0 same component is tried to be created from _root_ scope.

Caused by: org.koin.core.error.NoDefinitionFoundException: No definition found for type 'net.my.app.MyClass' on scope '['_root_']'. Check your Modules configuration and add missing type and/or qualifier! (Fix with AI)
                 	at org.koin.core.resolution.CoreResolverV2.resolveFromContext(CoreResolverV2.kt:160)
                 	at org.koin.core.scope.Scope.resolveFromContext(Scope.kt:329)
                 	at org.koin.core.scope.Scope.stackParametersCall(Scope.kt:292)
                 	at org.koin.core.scope.Scope.resolveInstance(Scope.kt:278)
                 	at org.koin.core.scope.Scope.resolve(Scope.kt:251)

The class is correctly scoped by dsl and it works fine in versions prior 4.2.0

To Reproduce
Steps to reproduce the behavior:

  1. Scope a class
  2. Call getOrCreateScope("someId", named("MyScope"), call declare("someId")
  3. Upgrade to 4.2.0
  4. Run

Expected behavior
A compont should be loaded from correct scope instead from _root_ scope
Koin module and version:
4.2.0

Unfortunately can't provide snippet.

Metadata

Metadata

Assignees

No one assigned

    Labels

    important 🔥status:checkingcurrently in analysis - discussion or need more detailed specs

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions