Server Error in '/' Application. Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
The stacktrace points to the System.Drawing.Gdip.GdipSaveImageToStream method - Please see file attached.
We followed many leads (web.config, users' rights, database, asp temporary folders, perfmon....) but could not sort this issue. The event viewer does not show any event related to that issue. The SharePoint ULS do not show any line related to this issue. The IIS logs do not show any lines related to this issue. There is no memory or cpu peaks occurring any time on the server.
The page is built with a Telerik.ReportViewer.WebForms.ReportViewer hosting a Telerik.reporting.Report. This report contains 8 charts using various fields from a result set returned by a stored procedure. To improved performance, this sproc is called once - the data is retrieved for the first chart only and reused to bound the 7 other charts (every chart NeedDataSource event points to Chat1_NeedDataSource method).
Interestingly, if we select incorrect parameters before requesting the report execution hence retrieving some invalid data that causes most charts to fail (6 out of 8), the remaining charts are rendered correctly. This seems consistent with the error message, that is, the more charts are being rendered the more risks of the error occurring.
This is the only page using Telerik.Reporting. Other pages use Telerik controls (including RadChart) but do not display the issue. The size of each chart checked on development environments is around 7Kb. The size of the chart created on another page via RadChart is 35Kb.
Have you ever seen anything like this?
Please let me know which information you need to help us.
Thanks,
Best regards,
Youss'
if
(!Page.IsPostBack)
{
Telerik.Reporting.ObjectDataSource obDS =
new
Telerik.Reporting.ObjectDataSource();
obDS.DataSource =
typeof
(HealthInspectionRptData);
obDS.DataMember =
"GetHealthInspectionReport"
;
obDS.Parameters.Add(
new
Telerik.Reporting.ObjectDataSourceParameter(
"ProgramYear"
,
typeof
(
int
),
(
int
)min2ProgramYearChosen));
obDS.Parameters.Add(
new
Telerik.Reporting.ObjectDataSourceParameter(
"ProgramID"
,
typeof
(
int
),
(
int
)mudtProgramID));
Telerik.Reporting.Report rpt =
new
HealthInspectionRpt();
rpt.DataSource = obDS;
rptViewer.Report = rpt;
rptViewer.RefreshReport();
//HealthInspectionRpt hInspRpt = new HealthInspectionRpt(min2ProgramYearChosen, min4SponsorID, mudtProgramID);
//rptViewer.Report = hInspRpt;
}
//this from my .aspx codebehind |
public partial class reporting_rep_invprodby_newlook2 : System.Web.UI.Page |
{ |
protected void Page_Load(object sender, EventArgs e) |
{ |
string username = User.Identity.Name; |
MasterReport report1 = new MasterReport(); |
ReportViewer1.Report = report1; |
//setting the value of Param1 in the line below |
report1.Param1 = username; |
} |
------------------------------------------------------------------------------ |
//this from the telerik report codebehind |
// Here is a sample query where the value for @ousername_vc |
//(this.ReportParameters["ousername_vc"].Value) gets lost |
SqlConnection connSomsys = new SqlConnection(@"Server=cmdivst004\Jason08;Integrated Security=false;Database=QuoteDB; Persist Security Info=True;User ID=gggg;Password=gggg"); |
SqlCommand selectLastYearTot; |
selectLastYearTot = new SqlCommand("sprocgetOrdertotlastyear", connSomsys); |
selectLastYearTot.CommandType = CommandType.StoredProcedure; |
selectLastYearTot.Parameters.AddWithValue("@ousername_vc", this.ReportParameters["ousername_vc"].Value); |
adapter3.Fill(dataSet3); |
this.table3.DataSource = dataSet3; |
//this is for one of the subreports in the NeedDataSource Event |
//for the subreport, it works fine |
SqlConnection connSomsys = new SqlConnection(@"Server=cmdivst004\Jason08;Integrated Security=false;Database=QuoteDB; Persist Security Info=True;User ID=cmdiapp;Password=adiadmin"); |
Telerik.Reporting.Processing.SubReport report =(Telerik.Reporting.Processing.SubReport)sender; |
SqlCommand selectCommand; |
selectCommand = new SqlCommand("sprocgetaccountingorders", connSomsys); |
selectCommand.CommandType = CommandType.StoredProcedure; |
//works fine right here line below |
selectCommand.Parameters.AddWithValue("@ousername_vc", this.ReportParameters["ousername_vc"].Value); |
SqlDataAdapter adapter = new SqlDataAdapter(selectCommand); |
DataSet dataSet = new DataSet(); |
adapter.Fill(dataSet); |
report.InnerReport.DataSource = dataSet; |
connSomsys.Dispose(); |
//Here is the property I created to take in the value of the username |
//much like the video |
public string Param1 |
{ |
get |
{ |
return (string)this.ReportParameters["ousername_vc"].Value; |
} |
set |
{ |
this.ReportParameters["ousername_vc"].Value = value; |
} |
} |