Description
Description
Just an annoyance, but it's slowing my debug of certain workflows, and leads to unnecessary reports of exceptions. It's an easy fix.
Here:
BHoM_Engine/Serialiser_Engine/Objects/BsonSerializers/MethodBaseSerializer.cs
Lines 169 to 172 in ae5f832
when types
is a non-null List<Type>
that contains only null
items, the types.ToArray()
method produces a null
result.
Then, the method call GetMethod()
or GetConstructor()
do not admit null
input for that parameter.
Steps to reproduce
It's easy to reproduce in a few lines of code:
List<Type> types = new List<Type>() { null };
Type[] typeArray = types.ToArray();
typeof(string).GetMethod("Count", typeArray);
The last line will throw an exception because we do not check if typeArray is null.
Expected behaviour:
We should first create typeArray
and check if it is null.
Test file(s):
Suggest to reproduce with the lines of code above. On my machine, it happens due to some particular DLLs that are loaded at startup.