ObjectFiller.NET icon indicating copy to clipboard operation
ObjectFiller.NET copied to clipboard

Exception when creating a collection of simple objects

Open HerrLoesch opened this issue 8 years ago • 0 comments

I wanted to create a list of objects. They must be of type object. I was not able to create them with Randomizer.Create(110) because there was no type Object registered.

Exception:

System.TypeInitializationException : Der Typeninitialisierer für "System.Object" hat eine Ausnahme verursacht. ----> System.Exception : The type [Object] was not registered in the randomizer. bei Tynamix.ObjectFiller.Filler1.GetRandomValue(Type propertyType, FillerSetupItem setupItem) bei Tynamix.ObjectFiller.Filler1.CreateAndFillObject(Type type, FillerSetupItem currentSetupItem, HashStack1 typeTracker) bei Tynamix.ObjectFiller.Filler1.Create() bei Tynamix.ObjectFiller.Filler`1.Create(Int32 count)

Then I tried this setup:

            Filler<object> objectFiller = new Filler<object>();
            objectFiller.Setup().OnType<object>().CreateInstanceOf<string>();

with this call:

objectFiller.Create(110)

and got the same Exception.

HerrLoesch avatar Jan 23 '17 12:01 HerrLoesch