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
Will work on a PR when got the time, just posting here for the record.
DynamicClassFactory.CreateType() will create a DynamicType with a "duplicate" constructor when the type has no properties and createParamterCtro = true.
This breaks later code when they try to find the constructor implementation.
I found this when doing:
var countQuery = query;
if (this.GroupBy != null)
{
countQuery = countQuery.GroupBy(
CustomParsingConfig.ParsingConfig,
this.GroupBy.KeySelector.Expression,
"new()");
}
result.Count = countQuery.Count();
Here I am using a dummy new() for the projection because I only want to count the results.
As a workaround, I replaced "new()" with "1", but still the bug is there.
The problem is when names.Length = 0:
The solution is to not create the second constructor if the type has no parameteres.
The text was updated successfully, but these errors were encountered:
StefH
changed the title
DynamicClassFactory fails to create dynamic type without properties
Issue: DynamicClassFactory fails to create dynamic type without properties
Oct 29, 2018
Will work on a PR when got the time, just posting here for the record.
DynamicClassFactory.CreateType() will create a DynamicType with a "duplicate" constructor when the type has no properties and createParamterCtro = true.
This breaks later code when they try to find the constructor implementation.
I found this when doing:
Here I am using a dummy new() for the projection because I only want to count the results.
As a workaround, I replaced "new()" with "1", but still the bug is there.
The problem is when names.Length = 0:
The solution is to not create the second constructor if the type has no parameteres.
The text was updated successfully, but these errors were encountered: