Hello
We have a generic base collection class ObjectCollection(Of T) inherited form System.ObjectModel.Collection(Of T). It provides just general collection for objects but raises events prior and after changes. We often inehrit from this collection to get specific collection. One of them is ButtonCollection (inherited as ObjectColection(Of Button)). In our base form, used as ancestor for all our forms property Buttons As ButtonCollection. DesignerSerializationVisibility is set to Content. When we edit this property in Visual Studio form designer, everything is OK. Collection editor Pops up, where we add and set up buttons and everything is correctly written to .Designer.vb file. But whe we rebuild our project, form designer refreshes itself and fails to load with error: Method 'ButtonCollection.AddRange' not found. AddRange is standard method to add multiple objects into collection at once. From this point designer is messed up and we have to restart Visual Studio.
This error occurs only in Visual Studio designer. Everything is OK at runtime - of course AddRange() method exists.
Does anybody know what could be a problem? It is VERY annoying and basically we cannot design our forms.
Thanks, Stano
We use updated Visual Studio 2008 with SP1, .NET framework 3.5 SP1, (though project is in .NET 2).
Call stack from designer is:
at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)
at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeExpression(IDesignerSerializationManager manager, String name, CodeExpression expression)
at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeStatement(IDesignerSerializationManager manager, CodeStatement statement)