System.UnauthorizedAccessException

Aug 26, 2010 at 8:36 AM

Hi,

When I create a new Instance in a BackgroundWorker , the VS 2010 throw a System.UnauthorizedAccessException:

 

protected override void OnDoWork(DoWorkEventArgs e)

{

PdfDocument document = new PdfDocument();

PdfPage page = document.AddPage();

XGraphics gfx = XGraphics.FromPdfPage(page);    "Error:System.UnauthorizedAccessException"

}

When I follow the code ,I found the error occured in PdfSharp.Drawing.XGraphics.Initialize():

MatrixTransform transform = new MatrixTransform() { Matrix = (System.Windows.Media.Matrix)matrix };

How can I use it in a background thread?

Thanks

by Mengk