Ran into a situation where GetAttributes(true) actually returned a null instead of an empty array on the .net core platform (it was a generated type using DefineType).
To accommodate weird scenario like that it should be easy enough to put a ? after the GetAttributes call