SQLCLR and sp_OA* procedures are not compatible

We ran into an issue today that is a bug you may need to be aware of because of its behavior.  

When a SQLCLR procedure calls back into the SQL Server (in proc provider) and executes sp_OA*, during the callback activity, it triggers a bug (currently filed and being evaluated) that results in heap corruption and the termination of the SQL Server process.  (The Microsoft security policy is clear that any detected heap corruption must result in process termination to reduce a possible injection attack vector(s).)

SQLCLR and sp_OA* can be used separately it is the callback from SQLCLR that triggers the bug behavior.   When the loopback occurs the activity can be assigned to a second worker thread.  The second worker and the parent worker are not handling the memory allocation properly, leading to the heap corruption.

SQL Server will NOT capture a mini-dump because of the process termination activity.  In order to capture detailed stack information you would need to use gflags or an external debugger.

Bob Dorr - Principal SQL Server Escalation Engineer