Background Job - Attempted to read or write protected memory

Hello,

I’m currently implementing Hangfire on an Umbraco website. ASP.NET.

I’ve got an api controller method that i use to enqueue a job. The job calls a class (not static) method (again not static) that accepts an ID. The ID is used to go and fetch details from a database, render a page to PDF using a paid PDF package and then send an email to whoever is concerned with the details attached.

All good so far - however occasionally (locally) - not been able to create on our test environment. I get the following exception thrown:

Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

Not seen this issue before has anyone else?