MEF2 error with custom metadata attributes


The nuget version of MEF (MEF2?) can't handle null values on custom metadata attributes when AllowMultiple is true. It will try to construct an array (which is ok) but TypeInspector.AddMetadata calls existingValue.GetType() -- if the metadata value is null this throws an exception.

An example is implementing a VS-style order attribute where you are supposed to set either the Before or After property but usually not both.
[AttributeUsage(AttributeTargets.All, AllowMultiple = true)]
public sealed class OrderAttribute : Attribute
    public string Before { get; set; }
    public string After { get; set; }