Re: generic error in GDI+ occurs when drawing windows metafile
- From: "Patrick Gannon" <Patrick Gannon@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 16 Jun 2005 14:20:04 -0700
Alejandro,
The problem occurs even in a single-threaded scenario, so I don't see how
the problem could be too many open handles. At the end of the "using" block,
Dispose() should be implicitly called on the Metafile object, which should
close any open handles, right? The print jobs are not the same length. They
vary in size from one page to over a thousand pages, but the problem doesn't
seem to be specific to large print jobs.
The code in question executes in a Windows service, and every subsequent
print request results in an "operation completed" exception, until I restart
the service and then everything works again. There also sometimes is a
"handle is invalid" exception that occurs right after the "generic error in
GDI+" exception, but before the series of "operation completed" exceptions.
Thanks for your help!
Pat
"Alejandro Lapeyre" wrote:
> Maybe too many open handles? (for windows)
>
> Are the print jobs the same length?
>
> Best Regards,
> Alejandro Lapeyre
>
> "Patrick Gannon" <Patrick Gannon@xxxxxxxxxxxxxxxxxxxxxxxxx> escribió en el
> mensaje news:978CC263-C5D7-41C1-B330-FA0279A26C60@xxxxxxxxxxxxxxxx
> >I am getting a sporadic external exception when drawing a windows metafile.
> > The odd part about this is that the problem only occurs about one out a
> > thousand times this code executes, and its the same metafiles that are
> > always
> > used (so it doesn't appear to be a problem with the metafile itself.) The
> > code is as follows:
> >
> > private void PrintLogo(Graphics graphics)
> > {
> > //graphics.PageUnit = GraphicsUnit.Display;
> > ResetTransform( graphics, true );
> > using(Metafile logo = new Metafile(_printer.LogoImagePath))
> > {
> > graphics.DrawImage(logo, 0, 0, LOGO_WIDTH, LOGO_HEIGHT);
> > }
> > if(_printer.Report.Type.DrawLogoSeparator)
> > {
> > graphics.DrawLine(new Pen(new SolidBrush(Color.Black), 1.0F), 0,
> > LOGO_HEIGHT, graphics.VisibleClipBounds.Width, LOGO_HEIGHT);
> > graphics.DrawLine(new Pen(new SolidBrush(Color.Black), 1.0F), 0,
> > LOGO_HEIGHT + 2, graphics.VisibleClipBounds.Width, LOGO_HEIGHT + 2.0F);
> > }
> > }
> >
> >
> >
> > The exception is as follows:
> >
> > Event Type: Error
> > Event Source: Traffic Print Service
> > Event Category: None
> > Event ID: 0
> > Date: 5/23/2005
> > Time: 4:29:21 PM
> > User: N/A
> > Computer: {omitted}
> > Description:
> >
> > General Information
> > *********************************************
> > Additional Info:
> > ExceptionManager.MachineName: {omitted}
> > ExceptionManager.TimeStamp: 5/23/2005 4:29:21 PM
> > ExceptionManager.FullName:
> > Microsoft.ApplicationBlocks.ExceptionManagement,
> > Version=1.0.1357.24421, Culture=neutral, PublicKeyToken=null
> > ExceptionManager.AppDomainName: {omitted}.traffic.output.service.exe
> > ExceptionManager.ThreadIdentity: {omitted}
> > ExceptionManager.WindowsIdentity: {omitted}
> >
> > 1) Exception Information
> > *********************************************
> > Exception Type: System.Runtime.InteropServices.ExternalException
> > ErrorCode: -2147467259
> > Message: A generic error occurred in GDI+.
> > TargetSite: Void CheckErrorStatus(Int32)
> > HelpLink: NULL
> > Source: System.Drawing
> >
> > StackTrace Information
> > *********************************************
> > at System.Drawing.Graphics.CheckErrorStatus(Int32 status)
> > at System.Drawing.Graphics.DrawImage(Image image, Single x, Single y,
> > Single width, Single height)
> > at
> > {omitted}.Traffic.Output.TrafficReportPrintDocument.PrintLogo(Graphics
> > graphics)
> > at
> > {omitted}.Traffic.Output.TrafficReportPrintDocument.OnPrintPage(PrintPageEventArgs
> > e)
> > at System.Drawing.Printing.PrintDocument._OnPrintPage(PrintPageEventArgs
> > e)
> > at System.Drawing.Printing.PrintController.PrintLoop(PrintDocument
> > document)
> > at System.Drawing.Printing.PrintController.Print(PrintDocument document)
> > at System.Drawing.Printing.PrintDocument.Print()
> > at {omitted}.Traffic.Output.ReportPrinter.Print(Boolean preview)
> > at {omitted}.Traffic.Output.Spooler.Print(PrintRequest request)
> > at {omitted}.Traffic.Output.Spooler.PrintLoop()
> >
> > For more information, see Help and Support Center at
> > http://go.microsoft.com/fwlink/events.asp.
> >
> > Thanks in advance for any help you can provide!
> > Patrick Gannon
>
>
>
.
- Follow-Ups:
- Re: generic error in GDI+ occurs when drawing windows metafile
- From: Alejandro Lapeyre
- Re: generic error in GDI+ occurs when drawing windows metafile
- References:
- generic error in GDI+ occurs when drawing windows metafile
- From: Patrick Gannon
- Re: generic error in GDI+ occurs when drawing windows metafile
- From: Alejandro Lapeyre
- generic error in GDI+ occurs when drawing windows metafile
- Prev by Date: Re: Window class name
- Next by Date: .net commands
- Previous by thread: Re: generic error in GDI+ occurs when drawing windows metafile
- Next by thread: Re: generic error in GDI+ occurs when drawing windows metafile
- Index(es):
Relevant Pages
|