ObjectHydrator
ObjectHydrator copied to clipboard
Applying a large string length attribute like [StringLength(4000)] randomly exceptions
It may be related to the TextGenerator's lorem ipsum having a length of 907. I see that you cap the length in one of TextGenerator's constructors, but I also see that the Length
setter is public and therefore could be set to a number larger than 907.
Here's a stack trace:
at System.String.Substring(Int32 startIndex, Int32 length)
at Foundation.ObjectHydrator.Generators.TextGenerator.Generate() in D:\DevProjects\2010Projects\ObjectHyrdrator\Foundation.ObjectHydrator\Generators\TextGenerator.cs:line 32
at Foundation.ObjectHydrator.Mapping`1.Generate() in D:\DevProjects\2010Projects\ObjectHyrdrator\Foundation.ObjectHydrator\Mapping.cs:line 47
at Foundation.ObjectHydrator.Hydrator`1.Populate(Object instance) in D:\DevProjects\2010Projects\ObjectHyrdrator\Foundation.ObjectHydrator\Hydrator.cs:line 533
at Foundation.ObjectHydrator.Hydrator`1.Generate() in D:\DevProjects\2010Projects\ObjectHyrdrator\Foundation.ObjectHydrator\Hydrator.cs:line 68
at Foundation.ObjectHydrator.Hydrator`1.GetSingle() in D:\DevProjects\2010Projects\ObjectHyrdrator\Foundation.ObjectHydrator\Hydrator.cs:line 60
// Snipped //
Result Message:
Test method Bridge.EF.Tests.EFBridgeTests.InsertPosts threw exception:
System.ArgumentOutOfRangeException: Index and length must refer to a location within the string.
Parameter name: length