Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The current SynchronizationContext may not be used as a TaskScheduler. #47

Closed
wil70 opened this issue May 19, 2020 · 0 comments
Closed

Comments

@wil70
Copy link

wil70 commented May 19, 2020

Hello,

Thanks for the library. This is great idea!
I tried the sample code:

         var desktops = VirtualDesktop.GetDesktops();

        // Get Virtual Desktop for specific window
        var desktop = VirtualDesktop.FromHwnd(Process.GetCurrentProcess().MainWindowHandle);

It compiles but when it arrive to the VirtualDesktop.GetDesktops(); it throws an exception:

  • System.InvalidOperationException: 'The current SynchronizationContext may not be used as a TaskScheduler.'

System.InvalidOperationException
HResult=0x80131509
Message=The current SynchronizationContext may not be used as a TaskScheduler.
Source=mscorlib
StackTrace:
at System.Threading.Tasks.SynchronizationContextTaskScheduler..ctor()

I'm using VS 2019 on Win 10....all latest version. I'm also using the latest version of your library
Thank you for your help
w.

@wil70 wil70 closed this as completed Jun 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant