Probably it is only supported in .NET Framework.
See also: https://devblogs.microsoft.com/dotnet/migrating-delegate-begininvoke-calls-for-net-core/.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
This is from a Microsoft WPF example. The source can be found on git as UsingDispatcher.
https://github.com/Microsoft/WPF-Samples/tree/master/Threading/SingleThreadedApplication
It is included zip file that has a lot of examples.
It is sort of written up hear. I have seen it in other places on MSDN. https://learn.microsoft.com/en-us/dotnet/desktop/wpf/advanced/threading-model?view=netframeworkdesktop-4.8&viewFallbackFrom=netdesktop-5.0.
I added the commented out line below the error. It works OK. Still, why the error?
Probably it is only supported in .NET Framework.
See also: https://devblogs.microsoft.com/dotnet/migrating-delegate-begininvoke-calls-for-net-core/.