The ‘DataType’ attribute is not declared

I recently came across a bug while working on a report using SQL Server 2008 Reporting Services.  I also have Visual Studio 2008 (incl. SP1) installed.

To be honest, to me it isn’t clear if I should call it a SQL Server bug or a Visual Studio bug.  If someone has a clear explanation on how these two packages work together please do let me know.  I know Business Intelligence Development Studio is Visual Studio with other templates, but where does Visual Studio end and SQL Server begin (or vice versa)?

Anyway, back to the point of this post, the error reads as follows:

Deserialization failed: The ‘DataType’ attribute is not declared

Initially I had started developing the report using BIDS 2005 and then I converted it to 2008.  One of the parameters was of type Integer and had 3 possible (hard-coded) values.  And it were these 3 values that were causing the issue.  As you may know, a Reporting Services report, an RDL, is actually made of XML.  The XML code for the available values was using an attribute called DataType to specify the type of the value.  However, this attribute is not specified in the XSD, the schema definition.

This is the offending XML code:

<ReportParameters>
   <ReportParameter Name="ReportParameter1">
     <DataType>Integer</DataType>
     <Prompt>ReportParameter1</Prompt>
     <ValidValues>
       <ParameterValues>
         <ParameterValue>
           <Value DataType="Integer">1</Value>
           <Label>first</Label>
         </ParameterValue>
         <ParameterValue>
           <Value DataType="Integer">2</Value>
           <Label>sec</Label>
         </ParameterValue>
         <ParameterValue>
           <Value DataType="Integer">3</Value>
           <Label>third</Label>
         </ParameterValue>
       </ParameterValues>
     </ValidValues>
   </ReportParameter>
 </ReportParameters>

And here’s the schema definition for the ParameterValue:

- <xsd:complexType name="ParameterValuesType">
- <xsd:sequence>
  <xsd:element name="ParameterValue" type="ParameterValueType" maxOccurs="unbounded" />
  </xsd:sequence>
  <xsd:anyAttribute namespace="##other" processContents="skip" />
  </xsd:complexType>
- <xsd:complexType name="ParameterValueType">
- <xsd:choice minOccurs="0" maxOccurs="unbounded">
  <xsd:element name="Value" type="xsd:string" minOccurs="0" />
  <xsd:element name="Label" type="StringLocIDType" minOccurs="0" />
  <xsd:any namespace="##other" processContents="skip" />
  </xsd:choice>
  <xsd:anyAttribute namespace="##other" processContents="skip" />
  </xsd:complexType>

As you can see, there’s no <xsd:attribute name=”DataType” …/> in this definition.

I have also been able to reproduce it just by creating a report from scratch using BIDS 2008.  I have not made any weird manipulation of the report, I’ve just been specifying the parameter, looking (not changing!) at the RDL, opening and closing it and here it is:

image

To solve the issue I manually removed the offending code parts:

DataType=”Integer”

Microsoft knows about the issue and has its status set to Resolved (External).  The feedback also contains the following statement:

We are escalating this issue to the appropriate group within the Visual Studio Product Team for triage and resolution. These specialized experts will follow-up with your issue.

That was the last comment on it by Microsoft.  I assume this means that it was a bug in Visual Studio after all and not in SQL Server, although it was clearly noticeable using BIDS 2008.  There is no link to any follow-up item or any other explanation on how to actually get a fix installed on your machine.  Do we need to wait until the next SP for VS2008 ships, or is it covered in the next SP for SQL Server 2008?  (You see now where my initial question came from – is it SQL Server or is it Visual Studio?)

Share

Tags: , ,

  1. bitnine’s avatar

    I’ve encountered this problem, and it would appear that the program in question sometimes generates XML that it chokes on when deserializing. Here’s the short of it:

    BREAKS:

    Integer

    1

    WORKS:

    Integer

    1

    Datatype as an attribute breaks. Simply excising the attribute with notepad worked for me.

    -bitnine

    Reply

  2. JerseryNo10’s avatar

    Hi guys I also had the same problem but thanks to you guys I sorted it out.
    in my case it generated the following xml:

    1
    MyLabel

    so I also removed the DataType attribute and changed it to

    1
    MyLabel

    That seems to have fixed it. oh well…

    Reply

  3. David’s avatar

    Thanks a million for this post – I had just encountered this problem for the first time, a couple of hours before a deployment was due to happen. Thanks to your post I was able to fix things quickly!

    Reply

  4. Nick’s avatar

    Thanks for your post Valentino! I have been having this same problem and had not yet figured it out on my own. Your solution worked.

    BTW…What part of Belgium do you call home? I had the privilege of living in your beautiful country for four years. I hope to be able to return again someday.

    Reply

    1. Valentino Vranken’s avatar

      Thanks for your comment Nick, glad it helped you :-)

      I live in Hoegaarden which is in Vlaams-Brabant, it’s the part of Belgium where Dutch is the mother tongue (although where I live is really close to the part where French is spoken, about 500 meters further to the south actually). The closest interesting city is Leuven, about 12kms from my place.

      How about you, where did you live? (and where are you from?)

      Regards, Valentino.

      Reply

  5. Mike’s avatar

    Hi Valentino,

    First: thank you very much for taking the time to put a detailed explanation and workaround for this issue. Like many others, I first thought I was going mad when I saw this.

    I just put SQL 2008 SP2 on my Visual Studio machine, and it looks like this issue may have been resolved. I’ve been able to look at and even edit hard-coded parameter values without it messing up the RDL code.

    Regards, Mike

    Reply

    1. Valentino Vranken’s avatar

      Hi Mike,

      Thanks for your comment and the additional info, good to hear that this issue no longer exists!

      Best regards, Valentino.

      Reply

    2. Cody’s avatar

      I have SQL 2008 SP2 and the issue still happens :-)

      Reply

  6. mary’s avatar

    I’ve added the service pack and it didn’t help me. I just went into the file via a text editor and converted all the “integer” to a value of “string” and it works.

    Reply

  7. Nick’s avatar

    I also added the service pack to no avail. Manually changing the text works. How annoying.

    Reply

  8. Michael’s avatar

    You saved the day with this posting, thanks!

    Reply

    1. Valentino Vranken’s avatar

      Glad to hear the day is okay, I can start concentrating on the night now! :)

      Reply

© 2008-2012 A Developer's Blog All Rights Reserved