I am trying to asynchronously log some information to SQL Server inside of an MVC 4 controller action targeting .NET 4.0 using the AsyncTargetingPack. I would jump straight
I was just having a very similar issue (NullReference from AssociateWithCurrentThread when using a logging task).
The issue I was having was that the original action did not await the completion of the logging task, so when the log finishes and tries to rejoin the original thread a nullReference is thrown because the original thread has terminated.
This was solved for me by making sure that the request controller awaited the logging function.