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:
To solve the issue I manually removed the offending code parts:
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?)