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

F# Data Toolbox: Twitter type provider - single-threaded apartment #12

Open
JonnyBoats opened this issue Apr 30, 2014 · 2 comments
Open

Comments

@JonnyBoats
Copy link

Referencing: http://fsprojects.github.io/FSharp.Data.Toolbox/TwitterProvider.html

When building a F# console application (as opposed to FSI) application-only authentication works just fine.

However
let connector = Twitter.Authenticate(key, secret)
fails with:

System.Threading.ThreadStateException was unhandled
Message: An unhandled exception of type 'System.Threading.ThreadStateException' occurred in System.Windows.Forms.dll
Additional information: ActiveX control '8856f961-340a-11d0-a96b-00c04fd705a2' cannot be instantiated because the current thread is not in a single-threaded apartment.

@evelinag
Copy link
Contributor

It seems to be a threading issue
http://stackoverflow.com/questions/1418466/single-threaded-apartment-cannot-instantiate-activex-control
Would it work if you created the new thread for Twitter connector yourself in your application?

I'm not sure if the PIN-based authentication is the right thing to do from a console application. There are other access options as well that we haven't implemented so far:
https://dev.twitter.com/docs/auth/obtaining-access-tokens
(we'll be happy for pull requests!)

@ghost
Copy link

ghost commented May 14, 2014

Hi

Got the same issue here trying in a compiled f#. (Interactive is great !)

Just a newbie here, here are my two cents

I think this has to do with this

http://stackoverflow.com/questions/6271078/f-windows-form-in-a-compiled-program

and this

http://stackoverflow.com/questions/13136605/object-oriented-hello-world-using-windows-forms-in-f

So maybe the form code for member TwitterWeb should use the compiler directives to tell if it is interactive or not

Thanks

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

2 participants