Strange error when seeking Collection.Count

Strange error when seeking Collection.Count

Old forum URL: forums.lhotka.net/forums/t/188.aspx


Jav posted on Wednesday, May 24, 2006

At Design time, whenever I look for a value (In intellisense or in the Watch window) for .Count of any of my collections, I see the following:

{"The generic type 'System.Collections.ObjectModel.Collection`1' was used with the wrong number of generic arguments in assembly 'mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.":"System.Collections.ObjectModel.Collection`1"}

No error is generated at run time, and .Count provides the correct value.  Have I done something wrong in creating my collections - like annoyed the generics lords?  Any ideas?

Jav

asmithDeveloper replied on Tuesday, November 21, 2006

Does nayone know how to fix this issue? I'm getting it, too.

Thanks,

Arnold

Bayu replied on Tuesday, November 21, 2006

My guess is that nothing is wrong.

It's just the case that your generic collection gets fully defined at run-time. Since then the collection is instantiated and the generic type can be resolved. Arguably, since the type would not affect the actual count in this particular case, the design-time environment might be smart enough to not show you this error. But with generics in general, the full extent of an object's behavior can only be determined run-time.

Regards,
Bayu

Copyright (c) Marimer LLC