byte[] and lazy loading

Nov 18, 2010 at 2:23 AM


I've got an XSD which defines a type like so:

<xsd:element name="Image" minOccurs="0" maxOccurs="unbounded">
         <xsd:extension base="xsd:base64Binary">
            <xsd:attribute name="type" type="DocumentationTypes" use="optional"/>
            <xsd:attribute name="mediaType" type="MediaTypes" use="optional"/>
            <xsd:attribute name="fileName" type="xsd:string" use="optional"/>
            <xsd:attribute ref="xml:lang" use="optional"/>

xsd2code defines the Value property of this image like so:

public byte[] Value {
    get {
        return this.valueField;
    set {
        this.valueField = value;

This is all fine. However, if I have EnableLazyLoading=true, the getter includes:

if ((this.valueField == null)) {
    this.valueField = new byte[]();

And since you can't create an array without a size, this won't compile. I can go through and take these out by hand where they occur, but it would be nice if xsd2code didn't include this for byte[] properties.


Nov 20, 2010 at 1:18 PM


you can try last 3.5 release. This bug is fixed.

Thank you for your feedback.