Quantcast
Channel: xsd2Code community edition .net class generator from XSD schema
Viewing all articles
Browse latest Browse all 543

Created Issue: Field not used warning [15266]

$
0
0
I am generating classes from my xsd's with the following parameters:

/p Net40 /xa /sc /ap /if-

This mostly works fine in 3.5.0.40152 (current latest version), except it is creating the private field "idFieldSpecified" for an ID attribute, and the compiler is throwing a "field not used" warning.

The CodeExtension.GeneratePropertyNameSpecifiedNullable method is removing the specified property if it is for an attribute, and failing to remove the backing field. This is because the method CodeDomHelper.GetSpecifiedFieldName is generating the name "iDFieldSpecified" rather than the correct "idFieldSpecified", which is then failing the comparison in CodeDomHelper.FindField.

I have fixed this locally by converting the strings to lower case before comparing them in CodeDomHelper.FindField:

if (codeMember.Name.ToLower() == searchFieldName.ToLower())
...

Note that I built the application from revision 91923 to see if it had already been fixed, but this generated a lot more backing fields than the 3.5.1 version, so I unfortunately couldn't use it.

Viewing all articles
Browse latest Browse all 543

Trending Articles