OneDrive / onedrive-sdk-csharp

OneDrive SDK for C#! https://dev.onedrive.com
Other
295 stars 145 forks source link

Exception User-Unhandled #243

Closed Kid-Seven-7 closed 6 years ago

Kid-Seven-7 commented 6 years ago

I'm trying to create a OneDrive Web Application and so far I can display the files and folders in the drive but I have been having trouble with downloading and uploading files. After finding this page on the internet I tried to use the code but got an error that is beyond my understanding (not sure if this is the right place but...).

System.Threading.ThreadStateException HResult=0x80131520 Message=ActiveX control '8856f961-340a-11d0-a96b-00c04fd705a2' cannot be instantiated because the current thread is not in a single-threaded apartment. Source= StackTrace:

If someone could point me in the right direction as far as this error that would be great
dominsights commented 6 years ago

Are you using asp.mvc or is it a console application? Did you register your application and set the app id? It's complaining about multithreading, have you tried creating a simple application to reproduce the problem? I'm on my phone now, I'll check later.

On Tue, Apr 10, 2018, 5:11 AM Joseph L. Ngoma notifications@github.com wrote:

I'm trying to create a OneDrive Web Application and so far I can display the files and folders in the drive but I have been having trouble with downloading and uploading files. After finding this page on the internet I tried to use the code but got an error that is beyond my understanding (not sure if this is the right place but...).

System.Threading.ThreadStateException HResult=0x80131520 Message=ActiveX control '8856f961-340a-11d0-a96b-00c04fd705a2' cannot be instantiated because the current thread is not in a single-threaded apartment. Source= StackTrace:

If someone could point me in the right direction as far as this error that would be great

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/OneDrive/onedrive-sdk-csharp/issues/243, or mute the thread https://github.com/notifications/unsubscribe-auth/AWjzKKOHHpbEvW2B81YeuOfV-kbQc_aMks5tnGkfgaJpZM4TNyix .

Kid-Seven-7 commented 6 years ago

I am working on a web application, I did register the app and set the app id, I have not reproduced the problem.

I'm a noob so I'm not real sure what's wrong, if you would like for me to send you additional information please let me know

On Tue, Apr 10, 2018 at 2:53 PM, Domício Medeiros notifications@github.com wrote:

Are you using asp.mvc or is it a console application? Did you register your application and set the app id? It's complaining about multithreading, have you tried creating a simple application to reproduce the problem? I'm on my phone now, I'll check later.

On Tue, Apr 10, 2018, 5:11 AM Joseph L. Ngoma notifications@github.com wrote:

I'm trying to create a OneDrive Web Application and so far I can display the files and folders in the drive but I have been having trouble with downloading and uploading files. After finding this page on the internet I tried to use the code but got an error that is beyond my understanding (not sure if this is the right place but...).

System.Threading.ThreadStateException HResult=0x80131520 Message=ActiveX control '8856f961-340a-11d0-a96b-00c04fd705a2' cannot be instantiated because the current thread is not in a single-threaded apartment. Source= StackTrace:

If someone could point me in the right direction as far as this error that would be great

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/OneDrive/onedrive-sdk-csharp/issues/243, or mute the thread https://github.com/notifications/unsubscribe- auth/AWjzKKOHHpbEvW2B81YeuOfV-kbQc_aMks5tnGkfgaJpZM4TNyix .

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/OneDrive/onedrive-sdk-csharp/issues/243#issuecomment-380087310, or mute the thread https://github.com/notifications/unsubscribe-auth/Adj0Gm59Nhl9dVJ9t2jLJy3h6TDZ2rw0ks5tnKswgaJpZM4TNyix .

-- Yours truly Joseph L. Ngoma

dominsights commented 6 years ago

Check this one:

https://stackoverflow.com/a/1418471/6490459

It looks like you'll need to create a separated thread to run your code.

On Tue, Apr 10, 2018 at 10:03 AM, Joseph L. Ngoma notifications@github.com wrote:

I am working on a web application, I did register the app and set the app id, I have not reproduced the problem.

I'm a noob so I'm not real sure what's wrong, if you would like for me to send you additional information please let me know

On Tue, Apr 10, 2018 at 2:53 PM, Domício Medeiros < notifications@github.com> wrote:

Are you using asp.mvc or is it a console application? Did you register your application and set the app id? It's complaining about multithreading, have you tried creating a simple application to reproduce the problem? I'm on my phone now, I'll check later.

On Tue, Apr 10, 2018, 5:11 AM Joseph L. Ngoma notifications@github.com wrote:

I'm trying to create a OneDrive Web Application and so far I can display the files and folders in the drive but I have been having trouble with downloading and uploading files. After finding this page on the internet I tried to use the code but got an error that is beyond my understanding (not sure if this is the right place but...).

System.Threading.ThreadStateException HResult=0x80131520 Message=ActiveX control '8856f961-340a-11d0-a96b-00c04fd705a2' cannot be instantiated because the current thread is not in a single-threaded apartment. Source= StackTrace:

If someone could point me in the right direction as far as this error that would be great

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/OneDrive/onedrive-sdk-csharp/issues/243, or mute the thread https://github.com/notifications/unsubscribe- auth/AWjzKKOHHpbEvW2B81YeuOfV-kbQc_aMks5tnGkfgaJpZM4TNyix .

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/OneDrive/onedrive-sdk-csharp/issues/ 243#issuecomment-380087310, or mute the thread https://github.com/notifications/unsubscribe-auth/ Adj0Gm59Nhl9dVJ9t2jLJy3h6TDZ2rw0ks5tnKswgaJpZM4TNyix .

-- Yours truly Joseph L. Ngoma

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/OneDrive/onedrive-sdk-csharp/issues/243#issuecomment-380090245, or mute the thread https://github.com/notifications/unsubscribe-auth/AWjzKBqk4WZXfYSxDhKOGNV1q7gO2Yrjks5tnK2XgaJpZM4TNyix .

Kid-Seven-7 commented 6 years ago

@domicioam Thanks so much for all your help, the stackoverflow link really helped, still having a few minor issues with MsaAuthenticationProvider.AuthenticateUserAsync() but hopefully that will not be too much of an issue. Thanks again 👍