.Net Standard 2.0 Nuget Package with dependency on System.ComponentModel.Annotations throws exceptions only when consumed from .Net Framework project

Viewed 878

I have a class library that targets netstandard2.0 and has a dependency on System.ComponentModel.Annotations v4.5. I am building a Nuget package from this class library.

When I consume the package from a .net core project it will work. When I consume the package from a .net framework 4.8 project I get the following exception:

Unable to cast object of type 'System.Collections.Generic.List`1[System.Int32]' to type 'System.Array'.

at System.ComponentModel.DataAnnotations.MinLengthAttribute.IsValid(Object value)

Any ideas on what I might need to do here?

0 Answers
Related