Silly me.
In my question, I said that this line causes the exception:
auto ret = method->Invoke(m_pWorker, arg_dummy);
Further, I said that
m_pWorker
was declared as
Object^
. This, of course, wasn't true. Actually, the declaration was
msclr::auto_gcroot<Object^>
, and the
Invoke
call should read:
auto ret = method->Invoke(m_pWorker.get(), arg_dummy);
Sometimes it helps to switch the mind to completely different tasks and then return to the problem :-)
Thanks to you who tried to lead me into the correct direction!