question

Michael-8660 avatar image
0 Votes"
Michael-8660 asked ·

Operation is not supported on this platform

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://docs.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?

74014-wpf-error.png


windows-wpfdotnet-runtime-core
wpf-error.png (39.6 KiB)
· 1
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

I just noticed the link are messed up. The text is correct but the hyperlinks behind them are wrong.

0 Votes 0 ·

1 Answer

Viorel-1 avatar image
1 Vote"
Viorel-1 answered ·

Probably it is only supported in .NET Framework.

See also: https://devblogs.microsoft.com/dotnet/migrating-delegate-begininvoke-calls-for-net-core/.

· 1 ·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

I marked it Accept Answer but it is not the complete answer. For some it maybe the answer.

I am not totally sure I understand it correctly. In a Wpf there are 2 thread poles. One outside the app which this article covers. The other, inside the app, is in the Dispatcher. Based on this and other things I have read BeginInvoke may still be alive in the dispatcher. I have always found it confusing when using BeginInvoke to know which thread pool I am using. Maybe being more explicit using Dispatcher.BeginInvoke is why my fix worked?????


This also shows that the Microsoft samples were never tested. They ran it threw an automated conversion routing to upgrade them to .NET Core and that is it. I wonder how many more gems there are in the samples. I hope someone can flag this to the powers-to-be to get them tested.

0 Votes 0 ·