Skip to content

Serialiser_Engine: missing null check in MethodBaseSerialiser, throws exception on startup #2823

Closed
@alelom

Description

@alelom

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:

if (methodName == ".ctor")
method = type.GetConstructor(types.ToArray());
else
method = type.GetMethod(methodName, types.ToArray());

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.

image

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.

Metadata

Metadata

Assignees

Labels

severity:lowDoesn't stop/slow current workflowtype:bugError or unexpected behaviour

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions