ObjectDisposedException in Application eventlog when used on IIS

When being used as part of ASP.net through IIS, it looks like something in Aspose.PDF v23.7.0 onwards (including v23.9.0) is generating an ObjectDisposedException approximately 1 minute after the DLL is used to convert HTML to PDF, I presume as part of the GC.

Here is the exception as recorded in the Window Logs / Application section of the event viewer…

An unhandled exception occurred and the process was terminated.

Application ID: /LM/W3SVC/1/ROOT

Process ID: 12636

Exception: System.ObjectDisposedException

Message: The CancellationTokenSource has been disposed.

StackTrace:    at System.Threading.CancellationTokenSource.ThrowObjectDisposedException()
   at #=zI6IPbUnSyGasiovyiaOrgco=.#=zBdAFb$d7kVumZ55oHw==.#=zG0vjPhoUHLT89n9Q2w==(Object #=zBeVXD7M=)
   at System.Threading.TimerQueueTimer.CallCallbackInContext(Object state)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.TimerQueueTimer.CallCallback()
   at System.Threading.TimerQueueTimer.Fire()
   at System.Threading.TimerQueue.FireNextTimers()
   at System.Threading.TimerQueue.AppDomainTimerCallback(Int32 id)

I do not know if it only happens on HTML to PDF, but that is the only time I’ve seen it.

We were alerted to the issue because it had a really, really strange knock-on consequence where (and I honestly don’t know how) immediately after the exception, the call to our SQL database is corrupted resulting in a “login failed”. It was only when I looked at the Windows Log / Application and tied up the time of the login errors to these exception that I realised that it was because of Aspose.PDF. And I only knew it was Aspose, because of the particular format of obfuscation you use.

The fault was reported on multiple production websites (running on Windows Server 2012, 2016 and 2019), and I was able to replicate on my local development environment (Windows 10)

We have have downgraded our sites to use v23.6.0 as the fault does not occur in that version.

It’s also worth noting that I was unable to replicate the error when using the DLL through a console application, and I’m therefore unable to provide you with an example.

We’re using Visual Studio 15 with ASP.Net 4.5.2.

Many thanks,
Tom

@stonefish

We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): PDFNET-55580

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.