Closed rvuistin closed 4 years ago
You can reproduce the problem with the NoVoidTypeOfExpressionsInGeneratedCodeEver test and the Schemas\XSD\W3C XMLSchema v1.xsd schema.
NoVoidTypeOfExpressionsInGeneratedCodeEver
Schemas\XSD\W3C XMLSchema v1.xsd
Generated code: return XTypedServices.ParseUnionValue(x, void.TypeDefinition); instead of: return XTypedServices.ParseUnionValue(x, null);
return XTypedServices.ParseUnionValue(x, void.TypeDefinition);
return XTypedServices.ParseUnionValue(x, null);
Happens in CreateFieldReference when typeName is an empty string instead of a null value:
CreateFieldReference
typeName
null
XObjectsCore.dll!Xml.Schema.Linq.CodeGen.CodeDomHelper.CreateFieldReference(string typeName, string fieldName) Line 465 C# XObjectsCore.dll!Xml.Schema.Linq.CodeGen.ClrPropertyInfo.GetSimpleTypeClassExpression() Line 1251 C# > XObjectsCore.dll!Xml.Schema.Linq.CodeGen.ClrPropertyInfo.AddGetStatements(System.CodeDom.CodeStatementCollection getStatements) Line 1020 C# XObjectsCore.dll!Xml.Schema.Linq.CodeGen.ClrPropertyInfo.AddToType(System.CodeDom.CodeTypeDeclaration parentTypeDecl, System.Collections.Generic.List<Xml.Schema.Linq.CodeGen.ClrAnnotation> annotations, Xml.Schema.Linq.GeneratedTypesVisibility visibility) Line 674 C# XObjectsCore.dll!Xml.Schema.Linq.CodeGen.TypePropertyBuilder.GenerateCode(Xml.Schema.Linq.CodeGen.ClrBasePropertyInfo property, System.Collections.Generic.List<Xml.Schema.Linq.CodeGen.ClrAnnotation> annotations) Line 30 C# XObjectsCore.dll!Xml.Schema.Linq.CodeGen.XTypedElementBuilder.CreateAttributeProperty(Xml.Schema.Linq.CodeGen.ClrBasePropertyInfo propertyInfo, System.Collections.Generic.List<Xml.Schema.Linq.CodeGen.ClrAnnotation> annotations) Line 782 C#
Hello, thanks for reporting this. It is now fixed in https://github.com/mamift/LinqToXsdCore/commit/0cfb38ff7e654f1919cc22f27715e3ceb23accb8.
You can reproduce the problem with the
NoVoidTypeOfExpressionsInGeneratedCodeEver
test and theSchemas\XSD\W3C XMLSchema v1.xsd
schema.Generated code:
return XTypedServices.ParseUnionValue(x, void.TypeDefinition);
instead of:return XTypedServices.ParseUnionValue(x, null);
Happens in
CreateFieldReference
whentypeName
is an empty string instead of anull
value: