I have an XML Schema Definition (XSD) file in Visual Studio 2010. The DataSet Designer should generate a strongly typed dataset in the <code><i><name></i>.designer.vb</code> file
Depending on a number of errant factors, it seems to sporadically provide strong typing for enumerable operations (used in LINQ or for each loops)
For instance, sometimes the generated code base is able to detect the type, and sometimes it's not:
The offending code seems to be whether or not the generated file has the function:
<!-- language: lang-vb -->Public Overridable Function GetEnumerator() As IEnumerator Implements IEnumerable.GetEnumerator
Return Me.Rows.GetEnumerator
End Function
If it does, then calling the enumerator for the function will return a boring object
.
If it doesn't, then the enumerator will return the appropriate type.
My Question:
How can I get it to consistently generate the appropriate behavior?
Our source code doesn't contain generated code, so each developer needs to generate it for themselves. This results in some machines getting compiler errors with improper typing, while others don't... with the same exact source code.
Some things that appear to having something to do with it:
- Assembly version targeted to .NET 4.0 VS .NET 4.0 Client
- Whether or not the XSD, designer, or usage files are open during generation
- Others?
Possible Workarounds:
- Include strong typing / casting with all declarations
- Include properly generated file in source control