Uploaded image for project: 'Spring.NET'
  1. Spring.NET
  2. SPRNET-1467

AbstractProxyMethodBuilder don't set generic argument type on method constraint


    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 1.3.2
    • Fix Version/s: 2.0
    • Labels:


      You have a class with a method with a constraint based on a generic argument of the class.
      Create a proxy for a object of that class.
      The method on the created proxy got a wrong constraint, once it doens't replace the generic argument on the constraint.

      Very simple example:
      public class ClassA<Z>
      public virtual void DoSomething<T>() where T : Z { }

      When you create a proxy for a object of type ClassA<string>, the proxy should have the method:
      public virtual void DoSomething<T>() where T : string { }

      But when the method is generated on the proxy the T : Z constraint isn't replaced by T : string.

      So I get the following error:
      System.TypeLoadException: Method 'DoSomething' on type 'DecoratorAopProxy_d4dcef2d192d458d9d5ca99705122487' from assembly 'Spring.Proxy, Version=, Culture=neutral, PublicKeyToken=65e474d141e25e07' tried to implicitly override a method with weaker type parameter constraints.

      I'm attaching a Test class that reproduce the error and a possible solution for the problem.




            • Assignee:
              bbaia Bruno Baia
              lorentz Lucas Lorentz
            • Votes:
              0 Vote for this issue
              1 Start watching this issue


              • Created: