title: SSRS: "Index was out of range" in VS2010 but not when report is deployed
body: <p>I have a simple report that keeps throwing the "index was out of range" error when i try to preview the report in VS. when i deploy the report to SSRS, it works perfectly. I've thoroughly looked for an answer already but none of them seem to apply to my situation.</p>
  
  <p>Error: Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index.</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;Report xmlns="http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition" xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner"&gt;
    &lt;Body&gt;
      &lt;ReportItems&gt;
        &lt;Textbox Name="textbox1"&gt;
          &lt;CanGrow&gt;true&lt;/CanGrow&gt;
          &lt;KeepTogether&gt;true&lt;/KeepTogether&gt;
          &lt;Paragraphs&gt;
            &lt;Paragraph&gt;
              &lt;TextRuns&gt;
                &lt;TextRun&gt;
                  &lt;Value&gt;Sales Report&lt;/Value&gt;
                  &lt;Style&gt;
                    &lt;FontFamily&gt;Tahoma&lt;/FontFamily&gt;
                    &lt;FontSize&gt;20pt&lt;/FontSize&gt;
                    &lt;FontWeight&gt;Bold&lt;/FontWeight&gt;
                    &lt;Color&gt;SteelBlue&lt;/Color&gt;
                  &lt;/Style&gt;
                &lt;/TextRun&gt;
              &lt;/TextRuns&gt;
              &lt;Style /&gt;
            &lt;/Paragraph&gt;
          &lt;/Paragraphs&gt;
          &lt;rd:DefaultName&gt;textbox1&lt;/rd:DefaultName&gt;
          &lt;Height&gt;0.36in&lt;/Height&gt;
          &lt;Width&gt;7.5in&lt;/Width&gt;
          &lt;Style&gt;
            &lt;PaddingLeft&gt;2pt&lt;/PaddingLeft&gt;
            &lt;PaddingRight&gt;2pt&lt;/PaddingRight&gt;
            &lt;PaddingTop&gt;2pt&lt;/PaddingTop&gt;
            &lt;PaddingBottom&gt;2pt&lt;/PaddingBottom&gt;
          &lt;/Style&gt;
        &lt;/Textbox&gt;
        &lt;Tablix Name="Tablix1"&gt;
          &lt;TablixCorner&gt;
            &lt;TablixCornerRows&gt;
              &lt;TablixCornerRow&gt;
                &lt;TablixCornerCell&gt;
                  &lt;CellContents&gt;
                    &lt;Textbox Name="Textbox5"&gt;
                      &lt;CanGrow&gt;true&lt;/CanGrow&gt;
                      &lt;KeepTogether&gt;true&lt;/KeepTogether&gt;
                      &lt;Paragraphs&gt;
                        &lt;Paragraph&gt;
                          &lt;TextRuns&gt;
                            &lt;TextRun&gt;
                              &lt;Value&gt;Sales Person&lt;/Value&gt;
                              &lt;Style /&gt;
                            &lt;/TextRun&gt;
                          &lt;/TextRuns&gt;
                          &lt;Style /&gt;
                        &lt;/Paragraph&gt;
                      &lt;/Paragraphs&gt;
                      &lt;rd:DefaultName&gt;Textbox5&lt;/rd:DefaultName&gt;
                      &lt;Style&gt;
                        &lt;Border&gt;
                          &lt;Color&gt;LightGrey&lt;/Color&gt;
                          &lt;Style&gt;Solid&lt;/Style&gt;
                        &lt;/Border&gt;
                        &lt;PaddingLeft&gt;2pt&lt;/PaddingLeft&gt;
                        &lt;PaddingRight&gt;2pt&lt;/PaddingRight&gt;
                        &lt;PaddingTop&gt;2pt&lt;/PaddingTop&gt;
                        &lt;PaddingBottom&gt;2pt&lt;/PaddingBottom&gt;
                      &lt;/Style&gt;
                    &lt;/Textbox&gt;
                  &lt;/CellContents&gt;
                &lt;/TablixCornerCell&gt;
              &lt;/TablixCornerRow&gt;
            &lt;/TablixCornerRows&gt;
          &lt;/TablixCorner&gt;
          &lt;TablixBody&gt;
            &lt;TablixColumns&gt;
              &lt;TablixColumn&gt;
                &lt;Width&gt;1.35417in&lt;/Width&gt;
              &lt;/TablixColumn&gt;
            &lt;/TablixColumns&gt;
            &lt;TablixRows&gt;
              &lt;TablixRow&gt;
                &lt;Height&gt;0.25in&lt;/Height&gt;
                &lt;TablixCells&gt;
                  &lt;TablixCell&gt;
                    &lt;CellContents&gt;
                      &lt;Textbox Name="Textbox4"&gt;
                        &lt;CanGrow&gt;true&lt;/CanGrow&gt;
                        &lt;KeepTogether&gt;true&lt;/KeepTogether&gt;
                        &lt;Paragraphs&gt;
                          &lt;Paragraph&gt;
                            &lt;TextRuns&gt;
                              &lt;TextRun&gt;
                                &lt;Value&gt;=SUM(Fields!Amount.Value * Fields!ExchangeRate.Value)&lt;/Value&gt;
                                &lt;Style&gt;
                                  &lt;Format&gt;0.##&lt;/Format&gt;
                                &lt;/Style&gt;
                              &lt;/TextRun&gt;
                            &lt;/TextRuns&gt;
                            &lt;Style /&gt;
                          &lt;/Paragraph&gt;
                        &lt;/Paragraphs&gt;
                        &lt;rd:DefaultName&gt;Textbox4&lt;/rd:DefaultName&gt;
                        &lt;Style&gt;
                          &lt;Border&gt;
                            &lt;Color&gt;LightGrey&lt;/Color&gt;
                            &lt;Style&gt;Solid&lt;/Style&gt;
                          &lt;/Border&gt;
                          &lt;PaddingLeft&gt;2pt&lt;/PaddingLeft&gt;
                          &lt;PaddingRight&gt;2pt&lt;/PaddingRight&gt;
                          &lt;PaddingTop&gt;2pt&lt;/PaddingTop&gt;
                          &lt;PaddingBottom&gt;2pt&lt;/PaddingBottom&gt;
                        &lt;/Style&gt;
                      &lt;/Textbox&gt;
                    &lt;/CellContents&gt;
                  &lt;/TablixCell&gt;
                &lt;/TablixCells&gt;
              &lt;/TablixRow&gt;
            &lt;/TablixRows&gt;
          &lt;/TablixBody&gt;
          &lt;TablixColumnHierarchy&gt;
            &lt;TablixMembers&gt;
              &lt;TablixMember&gt;
                &lt;Group Name="Year"&gt;
                  &lt;GroupExpressions&gt;
                    &lt;GroupExpression&gt;=Fields!Year.Value&lt;/GroupExpression&gt;
                    &lt;GroupExpression&gt;=Fields!Month.Value&lt;/GroupExpression&gt;
                  &lt;/GroupExpressions&gt;
                &lt;/Group&gt;
                &lt;SortExpressions&gt;
                  &lt;SortExpression&gt;
                    &lt;Value&gt;=Fields!Year.Value&lt;/Value&gt;
                  &lt;/SortExpression&gt;
                &lt;/SortExpressions&gt;
                &lt;TablixHeader&gt;
                  &lt;Size&gt;0.28125in&lt;/Size&gt;
                  &lt;CellContents&gt;
                    &lt;Textbox Name="Year"&gt;
                      &lt;CanGrow&gt;true&lt;/CanGrow&gt;
                      &lt;KeepTogether&gt;true&lt;/KeepTogether&gt;
                      &lt;Paragraphs&gt;
                        &lt;Paragraph&gt;
                          &lt;TextRuns&gt;
                            &lt;TextRun&gt;
                              &lt;Value&gt;=MonthName(Fields!Month.Value, True) &amp;amp; " " &amp;amp; Fields!Year.Value&lt;/Value&gt;
                              &lt;Style&gt;
                                &lt;Format&gt;0.##&lt;/Format&gt;
                              &lt;/Style&gt;
                            &lt;/TextRun&gt;
                          &lt;/TextRuns&gt;
                          &lt;Style /&gt;
                        &lt;/Paragraph&gt;
                      &lt;/Paragraphs&gt;
                      &lt;rd:DefaultName&gt;Year&lt;/rd:DefaultName&gt;
                      &lt;Style&gt;
                        &lt;Border&gt;
                          &lt;Color&gt;LightGrey&lt;/Color&gt;
                          &lt;Style&gt;Solid&lt;/Style&gt;
                        &lt;/Border&gt;
                        &lt;PaddingLeft&gt;2pt&lt;/PaddingLeft&gt;
                        &lt;PaddingRight&gt;2pt&lt;/PaddingRight&gt;
                        &lt;PaddingTop&gt;2pt&lt;/PaddingTop&gt;
                        &lt;PaddingBottom&gt;2pt&lt;/PaddingBottom&gt;
                      &lt;/Style&gt;
                    &lt;/Textbox&gt;
                  &lt;/CellContents&gt;
                &lt;/TablixHeader&gt;
              &lt;/TablixMember&gt;
            &lt;/TablixMembers&gt;
          &lt;/TablixColumnHierarchy&gt;
          &lt;TablixRowHierarchy&gt;
            &lt;TablixMembers&gt;
              &lt;TablixMember&gt;
                &lt;Group Name="RowGroup"&gt;
                  &lt;GroupExpressions&gt;
                    &lt;GroupExpression&gt;=Fields!SalesPerson.Value&lt;/GroupExpression&gt;
                  &lt;/GroupExpressions&gt;
                &lt;/Group&gt;
                &lt;TablixHeader&gt;
                  &lt;Size&gt;1.26042in&lt;/Size&gt;
                  &lt;CellContents&gt;
                    &lt;Textbox Name="SalesPerson"&gt;
                      &lt;CanGrow&gt;true&lt;/CanGrow&gt;
                      &lt;KeepTogether&gt;true&lt;/KeepTogether&gt;
                      &lt;Paragraphs&gt;
                        &lt;Paragraph&gt;
                          &lt;TextRuns&gt;
                            &lt;TextRun&gt;
                              &lt;Value&gt;=Fields!SalesPerson.Value&lt;/Value&gt;
                              &lt;Style /&gt;
                            &lt;/TextRun&gt;
                          &lt;/TextRuns&gt;
                          &lt;Style /&gt;
                        &lt;/Paragraph&gt;
                      &lt;/Paragraphs&gt;
                      &lt;rd:DefaultName&gt;SalesPerson&lt;/rd:DefaultName&gt;
                      &lt;Style&gt;
                        &lt;Border&gt;
                          &lt;Color&gt;LightGrey&lt;/Color&gt;
                          &lt;Style&gt;Solid&lt;/Style&gt;
                        &lt;/Border&gt;
                        &lt;PaddingLeft&gt;2pt&lt;/PaddingLeft&gt;
                        &lt;PaddingRight&gt;2pt&lt;/PaddingRight&gt;
                        &lt;PaddingTop&gt;2pt&lt;/PaddingTop&gt;
                        &lt;PaddingBottom&gt;2pt&lt;/PaddingBottom&gt;
                      &lt;/Style&gt;
                    &lt;/Textbox&gt;
                  &lt;/CellContents&gt;
                &lt;/TablixHeader&gt;
              &lt;/TablixMember&gt;
            &lt;/TablixMembers&gt;
          &lt;/TablixRowHierarchy&gt;
          &lt;DataSetName&gt;SalesLines&lt;/DataSetName&gt;
          &lt;Top&gt;0.42944in&lt;/Top&gt;
          &lt;Height&gt;0.53125in&lt;/Height&gt;
          &lt;Width&gt;2.61459in&lt;/Width&gt;
          &lt;ZIndex&gt;1&lt;/ZIndex&gt;
          &lt;Style&gt;
            &lt;Border&gt;
              &lt;Style&gt;None&lt;/Style&gt;
            &lt;/Border&gt;
          &lt;/Style&gt;
        &lt;/Tablix&gt;
      &lt;/ReportItems&gt;
      &lt;Height&gt;0.96069in&lt;/Height&gt;
      &lt;Style /&gt;
    &lt;/Body&gt;
    &lt;Width&gt;8in&lt;/Width&gt;
    &lt;Page&gt;
      &lt;PageHeight&gt;8.5in&lt;/PageHeight&gt;
      &lt;PageWidth&gt;11in&lt;/PageWidth&gt;
      &lt;LeftMargin&gt;1in&lt;/LeftMargin&gt;
      &lt;RightMargin&gt;1in&lt;/RightMargin&gt;
      &lt;TopMargin&gt;1in&lt;/TopMargin&gt;
      &lt;BottomMargin&gt;1in&lt;/BottomMargin&gt;
      &lt;Style /&gt;
    &lt;/Page&gt;
    &lt;AutoRefresh&gt;0&lt;/AutoRefresh&gt;
    &lt;DataSources&gt;
      &lt;DataSource Name="Reporting"&gt;
        &lt;DataSourceReference&gt;Reporting&lt;/DataSourceReference&gt;
        &lt;rd:SecurityType&gt;None&lt;/rd:SecurityType&gt;
        &lt;rd:DataSourceID&gt;aab21363-546f-4445-8789-9975de5d56bf&lt;/rd:DataSourceID&gt;
      &lt;/DataSource&gt;
    &lt;/DataSources&gt;
    &lt;DataSets&gt;
      &lt;DataSet Name="SalesLines"&gt;
        &lt;Query&gt;
          &lt;DataSourceName&gt;Reporting&lt;/DataSourceName&gt;
          &lt;CommandText&gt;SELECT SalesPerson, exchangeRate, Amount, Year(PostingDate) AS [Year], Month(PostingDate) AS [Month] FROM [dbo].[ReportingSalesLines]
  WHERE PostingDate BETWEEN '2012-10-01' AND '2013-09-30'&lt;/CommandText&gt;
          &lt;rd:UseGenericDesigner&gt;true&lt;/rd:UseGenericDesigner&gt;
        &lt;/Query&gt;
        &lt;Fields&gt;
          &lt;Field Name="ExchangeRate"&gt;
            &lt;DataField&gt;exchangeRate&lt;/DataField&gt;
            &lt;rd:TypeName&gt;System.Decimal&lt;/rd:TypeName&gt;
          &lt;/Field&gt;
          &lt;Field Name="SalesPerson"&gt;
            &lt;DataField&gt;SalesPerson&lt;/DataField&gt;
            &lt;rd:TypeName&gt;System.String&lt;/rd:TypeName&gt;
          &lt;/Field&gt;
          &lt;Field Name="Amount"&gt;
            &lt;DataField&gt;Amount&lt;/DataField&gt;
            &lt;rd:TypeName&gt;System.Decimal&lt;/rd:TypeName&gt;
          &lt;/Field&gt;
          &lt;Field Name="Year"&gt;
            &lt;DataField&gt;Year&lt;/DataField&gt;
            &lt;rd:TypeName&gt;System.Int32&lt;/rd:TypeName&gt;
          &lt;/Field&gt;
          &lt;Field Name="Month"&gt;
            &lt;DataField&gt;Month&lt;/DataField&gt;
            &lt;rd:TypeName&gt;System.Int32&lt;/rd:TypeName&gt;
          &lt;/Field&gt;
        &lt;/Fields&gt;
      &lt;/DataSet&gt;
    &lt;/DataSets&gt;
    &lt;Language&gt;en-US&lt;/Language&gt;
    &lt;ConsumeContainerWhitespace&gt;true&lt;/ConsumeContainerWhitespace&gt;
    &lt;rd:ReportUnitType&gt;Inch&lt;/rd:ReportUnitType&gt;
    &lt;rd:ReportID&gt;7d9922c6-e37f-4826-b58e-bd8b9427da1c&lt;/rd:ReportID&gt;
  &lt;/Report&gt;
  </code></pre>