You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First of all, thanks to all of the contributors for this project.
This is a very rare case, but it exists in our project. The issue happens when descendant class overrides indexer with new keyword and sets a different return type. In this case, Parserfinds two applicable methods, calls MethodHasPriority, and then fails here because MethodBase is null for IndexerData.
Unit test code to reproduce:
publicclassA{publicstring this[intindex]=>"some string";}publicclassB:A{publicnewint this[intindex]=>25;}[Test]publicvoid Test(){
var b =new B();
var interpreter =new Interpreter();varlambda= interpreter.Parse("this[0]",new Parameter("this", b));varres= lambda.Invoke(b);
Assert.AreEqual(25, res);}
I investigated the code, and, if this is ok, I would like to create a pull request with suggested solution for this issue.
The text was updated successfully, but these errors were encountered:
denbell5
added a commit
to denbell5/DynamicExpresso
that referenced
this issue
Apr 9, 2024
Hello!
First of all, thanks to all of the contributors for this project.
This is a very rare case, but it exists in our project. The issue happens when descendant class overrides indexer with
new
keyword and sets a different return type. In this case,Parser
finds two applicable methods, callsMethodHasPriority
, and then fails here becauseMethodBase
isnull
forIndexerData
.Unit test code to reproduce:
I investigated the code, and, if this is ok, I would like to create a pull request with suggested solution for this issue.
The text was updated successfully, but these errors were encountered: