BHoM / BHoM/BHoM_Engine

Reflection_Engine: Generic methods are compiled against their constraints, rather than the generic types themselves

Open
#1,138 3 comments 0 reactions 1 assignee Claimed by @epignatelli View on GitHub
type:bug
Dominant language
C#
Stars
30
Forks
13
Avg merge
7d 10h
Merged PRs (30d)
5

Description

#### Description:

When we use the `Engine.Reflection.Convert.ToFunc` method on generic methods, it returns a delegate whose input types are the constraints of the generic method.

#### How to replicate:

Open grasshopper, grab the BHoM methods through the `BHoMMethodList` method; use the ToFunc on one of the generic methods and check the inputs.

#### Expected behaviour:

The delegate should compile on the generic method, if possible.
The Serialisation_Engine can already deal with those: https://github.com/BHoM/BHoM_Engine/blob/master/Serialiser_Engine/Objects/BsonSerializers/TypeSerializer.cs#L90

#### Test file(s):

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.