ThreadStart.BeginInvoke throws NotSupportedException on Compact framework

后端 未结 2 1627
独厮守ぢ
独厮守ぢ 2021-01-14 21:48

I\'m working with threads on a compact framework project and have code that looks something like below. When I try to step into StartThreads(), a NotSupportedException is th

2条回答
  •  庸人自扰
    2021-01-14 22:28

    The BeginInvoke mechanism is not supported in CF, along with the ThreadPool.

    The reason you don't see the Exception where you expect is due to the way this is implemented. I am not totally sure about the details but BeginInvoke is not a normal method (of the Delegate class) but something that is injected at runtime (just guessing that last part).

    The error occurs when the JIT compiler gets to work on the StartThreads method.

提交回复
热议问题