Skip to content

Reflection Baking throws exception if a type contains methods with same name as a method with [Inject]. #85

@Monsoonexe

Description

@Monsoonexe

Describe the bug
The reflection baker fails with a Linq exception (enumeration contains more than one element when using SingleOrDefault) when operating on a type that has a method with the same name as a method with an [Inject] attribute.

To Reproduce
Run baker in Editor with a class like

public class MyClass
{
  public void Init() {}
  
  [Zenject.Inject]
  public void Init(Foo foo){}
}
  • Expected Behavior *
    Duplicate names should not be an issue because the weaver should look up a method by metadata (e.g. signature, attributes) not strictly by name.
  • Zenject version: 9.1.0
  • Unity version: 2019.4.40
  • Project's scripting backend: Mono 4.x

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions