This project has moved and is read-only. For the latest updates, please go here.
1
Vote

Dynamic binding: FragmentGenerator and return Fragment attribute mismatch not detected

description

The following code snippet should raise a warning, since changing InjectionCop annotations on dynamically bound methods is not supported because it would enforce bad design. Current implementation checks fragments of method parameters only, the task is to extend this behavior to support FragmentGenerator attribute and return fragments.
class AnnotatedBaseClass
{
      [FragmentGenerator]
      [return: CustomType]
      public virtual object CustomTypeGenerator()
      {
        return new object();
      }
}

class Inherited : AnnotatedBaseClass
{
      [return: Fragment("OtherType")]
      public override object CustomTypeGenerator()
      {
        return new object();
      }
}

comments