Security transparent method

Hi

We are occasionally getting the error you see below. How can we avoid it?

Regards
Klaus Kristiansen
KU

System.MethodAccessException: Attempt by security transparent method ‘xc0a8130c468d13ee.x5d2e33120f57f9ce+xd3534b62823d287a.x900b3a0ecc9d8e31()’ to access security critical method ‘System.Runtime.InteropServices.Marshal.Copy(IntPtr, Byte[], Int32, Int32)’ failed.

Assembly ‘Aspose.Pdf, Version=4.8.0.0, Culture=neutral, PublicKeyToken=716fcc553a201e56’ is marked with the AllowPartiallyTrustedCallersAttribute, and uses the level 2 security transparency model. Level 2 transparency causes all methods in AllowPartiallyTrustedCallers assemblies to become security transparent by default, which may be the cause of this exception.
at xc0a8130c468d13ee.x5d2e33120f57f9ce.xd3534b62823d287a.x900b3a0ecc9d8e31()
at xc0a8130c468d13ee.x5d2e33120f57f9ce.xccb2108c6c573d79(Bitmap x337e217cb3ba0627, Byte[] x8937c94fe87b48a5, Int32[] x3cfacdd7929d8569)
at xc0a8130c468d13ee.x5d2e33120f57f9ce.x789d651ae5cebc76(Image xe058541ca798c059, Object x6c50a99faab7d741, Boolean x2f4848efc41cf4b6)
at xc0a8130c468d13ee.x1c047fe8b1465e42.x18cf08c1e9e9238f(xa460a0b649265441 x2bd1c913e47cc91d, Int32 x81dc9ed015f52c46, String x8dcfbf7b6ef33595, String x6dcb3eaa4aca7389, Int32 x0784b68e528f2eb1, Int32 x6c884ce115067193, Boolean xc2b092f31bc52bbe, Stream xc8f3f690897a858e)
at xc0a8130c468d13ee.xcfb2332192a683c1.x043f162817640099(xa460a0b649265441 x2bd1c913e47cc91d, Int32 x8b80fc04f33816d2, ImageFileType x0182a6dae298f8a4, String x8dcfbf7b6ef33595, String xf3e8db661c71fd5e, String x6dcb3eaa4aca7389, Int32 x0784b68e528f2eb1, Int32 x6c884ce115067193, Boolean x4a29b7050d0b6013, Boolean xc2b092f31bc52bbe, Boolean x2407287b12d7a009, Byte[] xf1c258adc3c53c0e, Stream xc8f3f690897a858e)
at xc0a8130c468d13ee.xa460a0b649265441.x9a4e6b7d06323b1a(Image xe058541ca798c059, ImageFileType x0182a6dae298f8a4, String x8dcfbf7b6ef33595, String xf3e8db661c71fd5e, String x6dcb3eaa4aca7389, Int32 x0784b68e528f2eb1, Int32 x6c884ce115067193, Boolean x4a29b7050d0b6013, Boolean xc2b092f31bc52bbe, Byte[] xf1c258adc3c53c0e, Stream xc8f3f690897a858e)
at x3f91538e8c0de749.x8cc6f4ae84548c02.x7af2d95226c39577(Pdf x6beba47238e0ade6, Image xe058541ca798c059)
at x3f91538e8c0de749.x8cc6f4ae84548c02.xd3dfacf9ced05630(Pdf x6beba47238e0ade6, Section x4c742376f4cbaf27, Table x1ec770899c98a268, Cell xe6de5e5fa2d44af5, Image xe058541ca798c059, x33eef31791ddfc27 xb4012f98512a2f3d, xbfecfdaff4b493fe x96b3b0aca69853de)
at x3f91538e8c0de749.x3ea0b5a11618c323.x86d515adc7a0a302(Pdf x6beba47238e0ade6, Section x4c742376f4cbaf27, HeaderFooter x105be60320c854bc, Table x1ec770899c98a268, Row xa806b754814b9ae0, Cell xe6de5e5fa2d44af5, Image xe058541ca798c059, x33eef31791ddfc27 xb4012f98512a2f3d, xbfecfdaff4b493fe x96b3b0aca69853de, Boolean x70e701cee22724e3)
at x3f91538e8c0de749.x7576dadd7c449efa.x8810991188d773db(Pdf x6beba47238e0ade6, Section xb32f8dd719a105db, x33eef31791ddfc27 xb4012f98512a2f3d)
at x3f91538e8c0de749.x6a7cd842e95518d7.xc5e548c04b18e6e2(Pdf x6beba47238e0ade6)
at x3f91538e8c0de749.xaa36f84dba9d652f.x5ec1518f85fc1bbf(xb912e9429339cb81 x80010f902a1f736e, Pdf x6beba47238e0ade6)
at Aspose.Pdf.Pdf.Save(Stream stream)
at EPO.PDFConversion.ImageConverter.Convert(Stream input, Stream output) in c:\PROGRAMMING\WORKSPACE\VisualStudio\EPO\PDFconversion\ImageConverter.cs:line 44
at EPO.PDFConversion.Converter.ConvertToPDF(Stream input, String extension) in c:\PROGRAMMING\WORKSPACE\VisualStudio\EPO\PDFconversion\Converter.cs:line 24
at EPO.documents.UploadProcessor.ProcessStream(String fileName, Stream inputStream) in c:\PROGRAMMING\WORKSPACE\VisualStudio\EPO\documents\UploadProcessor.cs:line 25
at EPO.BaseForm.AttachAttachments(Employee employee) in c:\PROGRAMMING\WORKSPACE\VisualStudio\EPO\EPO\BaseForm.cs:line 267
at EPO.BaseForm.Journalize(String cpr, String fornavn, String efternavn) in c:\PROGRAMMING\WORKSPACE\VisualStudio\EPO\EPO\BaseForm.cs:line 159
at EPO.MedarbejderOplysningerTAP_VIP.Submit_click(Object sender, EventArgs e) in c:\PROGRAMMING\WORKSPACE\VisualStudio\EPO\EPO\MedarbejderOplysningerTAP_VIP.aspx.cs:line 82
at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at xc0a8130c468d13ee.x5d2e33120f57f9ce.xd3534b62823d287a.x900b3a0ecc9d8e31()
at xc0a8130c468d13ee.x5d2e33120f57f9ce.xccb2108c6c573d79(Bitmap x337e217cb3ba0627, Byte[] x8937c94fe87b48a5, Int32[] x3cfacdd7929d8569)
at xc0a8130c468d13ee.x5d2e33120f57f9ce.x789d651ae5cebc76(Image xe058541ca798c059, Object x6c50a99faab7d741, Boolean x2f4848efc41cf4b6)
at xc0a8130c468d13ee.x1c047fe8b1465e42.x18cf08c1e9e9238f(xa460a0b649265441 x2bd1c913e47cc91d, Int32 x81dc9ed015f52c46, String x8dcfbf7b6ef33595, String x6dcb3eaa4aca7389, Int32 x0784b68e528f2eb1, Int32 x6c884ce115067193, Boolean xc2b092f31bc52bbe, Stream xc8f3f690897a858e)
at xc0a8130c468d13ee.xcfb2332192a683c1.x043f162817640099(xa460a0b649265441 x2bd1c913e47cc91d, Int32 x8b80fc04f33816d2, ImageFileType x0182a6dae298f8a4, String x8dcfbf7b6ef33595, String xf3e8db661c71fd5e, String x6dcb3eaa4aca7389, Int32 x0784b68e528f2eb1, Int32 x6c884ce115067193, Boolean x4a29b7050d0b6013, Boolean xc2b092f31bc52bbe, Boolean x2407287b12d7a009, Byte[] xf1c258adc3c53c0e, Stream xc8f3f690897a858e)
at xc0a8130c468d13ee.xa460a0b649265441.x9a4e6b7d06323b1a(Image xe058541ca798c059, ImageFileType x0182a6dae298f8a4, String x8dcfbf7b6ef33595, String xf3e8db661c71fd5e, String x6dcb3eaa4aca7389, Int32 x0784b68e528f2eb1, Int32 x6c884ce115067193, Boolean x4a29b7050d0b6013, Boolean xc2b092f31bc52bbe, Byte[] xf1c258adc3c53c0e, Stream xc8f3f690897a858e)
at x3f91538e8c0de749.x8cc6f4ae84548c02.x7af2d95226c39577(Pdf x6beba47238e0ade6, Image xe058541ca798c059)
at x3f91538e8c0de749.x8cc6f4ae84548c02.xd3dfacf9ced05630(Pdf x6beba47238e0ade6, Section x4c742376f4cbaf27, Table x1ec770899c98a268, Cell xe6de5e5fa2d44af5, Image xe058541ca798c059, x33eef31791ddfc27 xb4012f98512a2f3d, xbfecfdaff4b493fe x96b3b0aca69853de)
at x3f91538e8c0de749.x3ea0b5a11618c323.x86d515adc7a0a302(Pdf x6beba47238e0ade6, Section x4c742376f4cbaf27, HeaderFooter x105be60320c854bc, Table x1ec770899c98a268, Row xa806b754814b9ae0, Cell xe6de5e5fa2d44af5, Image xe058541ca798c059, x33eef31791ddfc27 xb4012f98512a2f3d, xbfecfdaff4b493fe x96b3b0aca69853de, Boolean x70e701cee22724e3)
at x3f91538e8c0de749.x7576dadd7c449efa.x8810991188d773db(Pdf x6beba47238e0ade6, Section xb32f8dd719a105db, x33eef31791ddfc27 xb4012f98512a2f3d)
at x3f91538e8c0de749.x6a7cd842e95518d7.xc5e548c04b18e6e2(Pdf x6beba47238e0ade6)
at x3f91538e8c0de749.xaa36f84dba9d652f.x5ec1518f85fc1bbf(xb912e9429339cb81 x80010f902a1f736e, Pdf x6beba47238e0ade6)
at Aspose.Pdf.Pdf.Save(Stream stream)

Hi Klaus,


Thanks for contacting support and sorry for the delayed response.

Can you please share some details regarding your requirement i.e. the feature you are trying to accomplish with Aspose.Pdf for .NET. Also can you please share some code snippet/sample project which can help us in replicating this issue at our end as I am afraid its quite difficult to figure out the problem from StackTrace (all I can understand is that you are trying to convert images to PDF format). We are sorry for this inconvenience.

BTW, I have observed that you are using quite older release of Aspose.Pdf for .NET and the latest release of Aspose.Pdf for .NET is 9.3.0.