In my constructor of a class, I call a virtual member. Whether this should or should not be done is out of scope for my question.
WORKS (can call in my constructor):
protected void DoSomething();
protected virtual void DoSomething();
DOES NOT WORK
protected override void DoSomething();
The DOES NOT WORK part is located in the same library, the derived class has the same visibility, etc. As soon as I override the (virtual or abstract) DoSomething defined in class A in my Class B, I get a MissingMethodException as soon as the method is executed.
Does anyone have an idea why?
After lots of debugging, trying, etc, it seems that a class I used inside the method derived from an interface with this definition:
It seems you cannot use covariant type parameters, otherwise you will get this exception.
For more information, see this blog post.