Attempted to write to protected memory when saving chart.
Posted: Fri Jun 22, 2007 4:26 pm
We have a web based application developed in VB.NET that uses TeeChart to produce graphs as jpeg images which we then display on a web page. Code similiar to this:
The function wil run fine for awhile but eventually we get the following error:
TeeChart 2.0.2179.21171
NET 2.0
Windows Server 2003
Any ideas?
Thanks for looking.
Code: Select all
Private ChartProcessor As Steema.TeeChart.TChart
Private Sub GetChart(thisStartDate As String, thisDataTable As Object)
'-----------------------------------------
' This routine creates the chart
'------------------------------------------
Call TChart_Create(thisStartDate, thisDataTable)
'--------------------------------------------------------
' Jpeg is written to a session object for retrieval
'---------------------------------------------------------
thisStream = New System.IO.MemoryStream()
ChartProcessor.Export.Image.JPEG.Save(thisStream)
Sess.Contents("Chart" & thisChartID) = thisStream
End Sub
The function wil run fine for awhile but eventually we get the following error:
After this error is received, the function errors every time after that untill we reset IIS on the webserver.Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
at System.Drawing.SafeNativeMethods.Gdip.GdipGetImageGraphicsContext(HandleRef image, IntPtr& graphics)
at System.Drawing.Graphics.FromImage(Image image)
at Steema.TeeChart.Chart.Bitmap(Int32 width, Int32 height, PixelFormat pixelformat)
at Steema.TeeChart.Chart.Bitmap(Int32 width, Int32 height)
at Steema.TeeChart.Export.ImageExportFormat.Save(Stream stream)
TeeChart 2.0.2179.21171
NET 2.0
Windows Server 2003
Any ideas?
Thanks for looking.