I have encountered a strange issue with MigraDoc. I use MigraDoc to generate PDF-files in ASP.NET website. I run this website in MS Azure as App Service.
Error occurs after calling MigraDoc.Rendering.PdfDocumentRenderer.RenderDocument() and the mysterious error is: "Win32Exception (0x80004005): The operation completed successfully". Stack trace is below.
This does not reproduce in my testing environment, which is also in Azure. I connected testing to production data. Production environment was working very well yesterday (and for weeks), but now it fails every time.
My website is not very popular and it gets like 1000 hits per day. It's safe to assume that only one PDF is generated at a time.
After some googling, it seems that this issue might be related to running out some resources.
Is there something I should know about running MigraDoc in ASP.NET application? Or in Azure?
Does anyone have any clue what is this issue and how to fix it?
Edit:
I am using WPF-version (MigraDoc.Rendering-wpf.dll) and version number is 1.50.3638.0.
Stacktrace:
Quote:
[Win32Exception (0x80004005): The operation completed successfully]
MS.Win32.UnsafeNativeMethods.RegisterClassEx(WNDCLASSEX_D wc_d) +96
MS.Win32.HwndWrapper..ctor(Int32 classStyle, Int32 style, Int32 exStyle, Int32 x, Int32 y, Int32 width, Int32 height, String name, IntPtr parent, HwndWrapperHook[] hooks) +978
System.Windows.Threading.Dispatcher..ctor() +612
System.Windows.Threading.Dispatcher.get_CurrentDispatcher() +64
PdfSharp.Drawing.XGraphics..ctor(DrawingContext dc, XSize size, XGraphicsUnit pageUnit, XPageDirection pageDirection) +71
MigraDoc.Rendering.DocumentRenderer.PrepareDocument() +397
MigraDoc.Rendering.PdfDocumentRenderer.PrepareDocumentRenderer(Boolean prepareCompletely) +148
MigraDoc.Rendering.PdfDocumentRenderer.PrepareRenderPages() +22
MigraDoc.Rendering.PdfDocumentRenderer.RenderDocument() +16
Foo.Foo.Foo.CreateMinutes(TemplateModel model, Boolean withResults) +262
Foo.Controllers.ReportController.CreateMinutes(Nullable`1 id, Nullable`1 id2) +611
lambda_method(Closure , ControllerBase , Object[] ) +215
System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +209
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +35
System.Web.Mvc.Async.AsyncControllerActionInvoker.<BeginInvokeSynchronousActionMethod>b__39(IAsyncResult asyncResult, ActionInvocation innerInvokeState) +40
System.Web.Mvc.Async.WrappedAsyncResult`2.CallEndDelegate(IAsyncResult asyncResult) +71
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) +43
System.Web.Mvc.Async.AsyncInvocationWithFilters.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3d() +72
System.Web.Mvc.Async.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f() +386
System.Web.Mvc.Async.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f() +386
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult) +43
System.Web.Mvc.Async.<>c__DisplayClass2b.<BeginInvokeAction>b__1c() +30
System.Web.Mvc.Async.<>c__DisplayClass21.<BeginInvokeAction>b__1e(IAsyncResult asyncResult) +186
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +39
System.Web.Mvc.Controller.<BeginExecuteCore>b__1d(IAsyncResult asyncResult, ExecuteCoreState innerState) +29
System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +67
System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +53
System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +36
System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +39
System.Web.Mvc.MvcHandler.<BeginProcessRequest>b__5(IAsyncResult asyncResult, ProcessRequestState innerState) +44
System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +67
System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +39
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +657
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +146