Microsoft Report Viewer 2012 exception "Not enough storage is available to process this command"

StackOverflow https://stackoverflow.com/questions/21251811

質問

I have an WCF Client application developed in VS2012. I use MS Report Viewer 2012 (Microsoft.ReportViewer.WinForms 11.0.3366.16) to execute and display the report in my application. The problem is that when this report executes in any 32bit environment I get this exception. The interesting thing is that it doesn't happen at the same point on the different 32bit machines.

  • On some machines it happens just before the data is displayed in the report. On tracking memory usage between a 64bit and 32bit machine I've noticed that on the 64bit machine the memory usage spike to about 1.3GB (Private Bytes for the application). On the 32bit machine, it spikes to about 650MB of RAM and then gives the exception. On the 32bit machine there is still a lot of physical and virtual memory left when this happens, and that is what baffles me. The error keeps popping up if you continue as well.

  • On other machines it happens when you export the report to Excel after the report renders without incident. The error is a bit different but changes intermittently as you close the exception, and one of the errors is the "Not enough storage" error.

  • When you run this report from a browser it works fine without a problem.

  • On Friday when I tested the report, it worked perfectly on 2 32bit machines without problem, and I thought the problem is solved, but Monday came, and the error was back. I asked the guys to restart there machines to make sure that nothing unnecessary things are loaded in memory, but with no luck.

I find a lot of issues regarding the error on the internet, but none of the solutions proof to be working. Is there anybody that can maybe give me some insight to what to look for, because I'm not sure where to find an answer anymore.

The report dataset have about 300,000 rows that is aggregated in the report to about 3,000 rows displayed.

If there is any more detail required, please ask. I need to solve this problem.

EDIT

Here is some of my code setting up the report.

void BaseReportingForm_Load(object sender, System.EventArgs e)
{

        rptViewer.ServerReport.ReportPath = "/test/TestReport";
        rptViewer.ServerReport.ReportServerUrl = new Uri("http://localhost:80/ReportServer");
        rptViewer.ServerReport.ReportServerCredentials.NetworkCredentials = new System.Net.NetworkCredential(
            "Developer", "Password", "Domain");
        rptViewer.ProcessingMode = Microsoft.Reporting.WinForms.ProcessingMode.Remote;
        rptViewer.ShowParameterPrompts = false;

        this.RefreshReport();
        //cant do this here as the parameters that are dynamically loaded will not be populated
        LoadParameters(null);
}

void RefreshReport()
{
    this.RefreshReport(null);
}

void RefreshReport(Microsoft.Reporting.WinForms.ReportParameterInfoCollection pParameters)
{
    //run in seperate thread...
    object[] argArr = new object[] { pParameters };
    if (reportBackgroundWorker.IsBusy)
    {
        restartWorker = true;
        reportBackgroundWorker.CancelAsync();
    }
    else
    {
        reportBackgroundWorker.RunWorkerAsync(argArr);
    }
}

void LoadParameters(Microsoft.Reporting.WinForms.ReportParameterInfoCollection pParameters)
{
    this.catchClick = false;
    if (pParameters != null) //only load the parameter collection
    {
        Microsoft.Reporting.WinForms.ReportParameterInfoCollection rptParameters = rptViewer.ServerReport.GetParameters();
        foreach (Microsoft.Reporting.WinForms.ReportParameterInfo rptParam in rptParameters)
        {
            if (rptParam.Prompt != "")
            {
                //Code removed. Just creating edits and combo's for parameters to be captured
            }
        }
    }
    else //reload whole group
    {
        //First delete the group if it exists

        //Get parameters and add it to the group as items
        string version = rptViewer.ServerReport.GetServerVersion();
        Microsoft.Reporting.WinForms.ReportParameterInfoCollection rptParameters = rptViewer.ServerReport.GetParameters();

        int paramPosition = 0;
        foreach (Microsoft.Reporting.WinForms.ReportParameterInfo rptParam in rptParameters)
        {
            if (rptParam.Prompt != "")
            {
                //Code removed. Just creating edits and combo's for parameters to be captured
            }
        }
    }
}

public void RunReport()
{
    this.RefreshReport();
}

private void reportBackgroundWorker_DoWork(object sender, DoWorkEventArgs e)
{
    rptViewer.Invoke(new MethodInvoker(delegate()
    {
        //Removed the code that populates the parameters from the created edits and combo's and put some hardcoded params in here

        var vParameters = new List<Microsoft.Reporting.WinForms.ReportParameter>();
        vParameters.Add(new Microsoft.Reporting.WinForms.ReportParameter("Param1", "Param1"));
        rptViewer.ServerReport.SetParameters(vParameters);
        rptViewer.RefreshReport();
    }));
}

private void reportBackgroundWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
{
    if (e.Cancelled && restartWorker)
    {
        restartWorker = false;
        this.RefreshReport();
    }

    if (e.Error != null)
    {
        throw e.Error;
    }
    else
    {

    }
}

EDIT 2

From my research, I found this link: http://unixwiz.net/techtips/not-enough-codes.html It seems that the system explicitly runs out of Memory or Handles. Is the best cause of action to hound MS about it, and hope they come back to a man?

Thanks

役に立ちましたか?

解決

After a year I still didn't receive a proper answer on this. I've rolled back to the previous version on Report Viewer (version 9) and it solved the problem, but I still don't have a clue why version 11 only works properly on 64bit systems

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top