Welcome Guest Search | Active Topics | Sign In | Register

Exception: System.AccessViolationException: Attempted to read or write protected memory. Options
L
Posted: Friday, July 25, 2014 5:56:02 PM
Rank: Newbie
Groups: Member

Joined: 5/30/2014
Posts: 2
This only happens when the application is deployed to a separate test environment(Windows Server 2008, IIS7), but things work fine in development.

Let me know what other information I can provide to you.

The relevant code from the controller:
Quote:

string s = GetHTMLString();
var doc = new PdfDocument();
HtmlToPdf.ConvertHtml(s, doc);
var ms = new MemoryStream();
doc.Save(ms);
ms.Position = 0;
return File(ms, "application/pdf", "Dash.pdf");


Exception is thrown on line 997, which is "HtmlToPdf.ConvertHtml(s, doc);"

[Exception: System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.DoEvents()
at EO.Pdf.Internal.bu.a(WaitHandle A_0, Int32 A_1, hx A_2)
at EO.Pdf.Internal.c8.a(Boolean A_0, t A_1, Int32 A_2, hx A_3)
at EO.Pdf.Internal.c8.a(HtmlToPdfOptions A_0, String A_1, Boolean A_2)
at EO.Pdf.Internal.c8.b(HtmlToPdfOptions A_0, String A_1, Boolean A_2)
at EO.Pdf.Internal.c8.a(br A_0)
at EO.Pdf.Internal.lm.c.a(Byte[] A_0)]
EO.Pdf.Internal.a.b(BinaryReader A_0) +166
EO.Pdf.Internal.lm.a(a A_0) +1134
EO.Pdf.HtmlToPdfSession.a(a A_0) +80
EO.Pdf.HtmlToPdfSession.a(jw A_0, String A_1, String A_2, Int32 A_3, Int32 A_4, Boolean A_5) +100
EO.Pdf.HtmlToPdf.ConvertHtml(String html, PdfDocument doc, HtmlToPdfOptions options) +94
GM.Ui.Mvc.Controllers.DashboardController.ExportGrantListToPdf(List`1 grantNames, GrantSearchModel searchModel) in c:\dev\GM\UI\Controllers\DashboardController.cs:997
GM.Ui.Mvc.Controllers.DashboardController.Select(String dashboardCommand, Boolean isCollapsed, String ProgId) in c:\dev\GM\UI\Controllers\DashboardController.cs:106
lambda_method(Closure , ControllerBase , Object[] ) +596
System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) +14
System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +194
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +27
System.Web.Mvc.Async.<>c__DisplayClass42.<BeginInvokeSynchronousActionMethod>b__41() +28
System.Web.Mvc.Async.<>c__DisplayClass8`1.<BeginSynchronous>b__7(IAsyncResult _) +10
System.Web.Mvc.Async.WrappedAsyncResult`1.End() +50
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) +32
System.Web.Mvc.Async.<>c__DisplayClass39.<BeginInvokeActionMethodWithFilters>b__33() +58
System.Web.Mvc.Async.<>c__DisplayClass4f.<InvokeActionMethodFilterAsynchronously>b__49() +225
System.Web.Mvc.Async.<>c__DisplayClass37.<BeginInvokeActionMethodWithFilters>b__36(IAsyncResult asyncResult) +10
System.Web.Mvc.Async.WrappedAsyncResult`1.End() +50
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult) +34
System.Web.Mvc.Async.<>c__DisplayClass2a.<BeginInvokeAction>b__20() +23
System.Web.Mvc.Async.<>c__DisplayClass25.<BeginInvokeAction>b__22(IAsyncResult asyncResult) +99
System.Web.Mvc.Async.WrappedAsyncResult`1.End() +50
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +27
System.Web.Mvc.<>c__DisplayClass1d.<BeginExecuteCore>b__18(IAsyncResult asyncResult) +14
System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +23
System.Web.Mvc.Async.WrappedAsyncResult`1.End() +55
System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +39
System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +23
System.Web.Mvc.Async.WrappedAsyncResult`1.End() +55
System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +29
System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult) +10
System.Web.Mvc.<>c__DisplayClass8.<BeginProcessRequest>b__3(IAsyncResult asyncResult) +25
System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +23
System.Web.Mvc.Async.WrappedAsyncResult`1.End() +55
System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +31
System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +9514928
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155
L
Posted: Friday, July 25, 2014 7:46:34 PM
Rank: Newbie
Groups: Member

Joined: 5/30/2014
Posts: 2
I looked into the issue a bit more and it turns out that this is caused by one line in one of the css files referenced by the html.
It has the following line:
@import url("http://fonts.googleapis.com/css?family=PT+Sans:regular,italic,bold");

Removing it resolves the issue in the test environment.
It still doesn't explain why the exception occurs only in the test environment and not in development.
eo_support
Posted: Saturday, July 26, 2014 10:18:32 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,196
Hi,

Please check the version number of your EO.Pdf.dll. This is essentially a crash and can be caused by different reasons, some of them are fixable and some of them are not (for example, out of memory situations). We did fix one case related to font since our earlier versions only supports TrueType font, not PostScript font. So you might want to try the latest build first and see if that resolves the issue for you. The latest EO.Pdf.dll version is 5.0.87.2.

If that still does not resolve the issue, please try to isolate the problem to a test project and send us the test project. See here for more information about how to submit test project to us:

http://www.essentialobjects.com/forum/test_project.aspx

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.