Need to see if your shared folder is taking up space on your dropbox 👨💻? Find out how to check here.
Forum Discussion
Dan C.10
9 years agoExplorer | Level 4
Exception when using ASP.NET Core
I'm trying to use the Dropbox API with an ASP.NET Core application (v1.1.0). It compiles and resolves all the dependencies when doing a "dotnet restore", but when I call one of the Dropbox API methods, it throws the following exception...
An unhandled exception has occurred: Could not load file or assembly 'System, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes'. The system cannot find the file specified. System.IO.FileNotFoundException: Could not load file or assembly 'System, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes'. The system cannot find the file specified. File name: 'System, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes' at Dropbox.Api.Files.ListFolderArg..ctor(String path, Boolean recursive, Boolean includeMediaInfo, Boolean includeDeleted, Boolean includeHasExplicitSharedMembers at Dropbox.Api.Files.Routes.FilesUserRoutes.ListFolderAsync(String path, Boolean recursive, Boolean includeMediaInfo, Boolean includeDeleted, Boolean includeHasExplicitSharedMembers at ******.Core.Respositories.BlogPostDropboxRepository.d__4.MoveNext() in C:\code\******\******.Core\Respositories\BlogPostDropboxRepository.cs:line 31 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw( at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult( at ******.Controllers.HomeController.d__2.MoveNext() in C:\code\******\******.Web\Controllers\HomeController.cs:line 18 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw( at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.d__27.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw( at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.d__25.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw( at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ActionExecutedContext context at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.d__22.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw( at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ResourceExecutedContext context at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.d__20.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw( at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task at Microsoft.AspNetCore.Builder.RouterMiddleware.d__4.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw( at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.d__6.MoveNext()
Looks very similar to this unanswered Stackoverflow question I found when trying to Google for a solution:
http://stackoverflow.com/questions/38535571/dropbox-api-throws-filenotfoundexception
6 Replies
- Greg-DB9 years ago
Dropbox Community Moderator
Thanks for the report! I can't seem to reproduce this issue though. Can you let us know the following so we can look into it?
- What platform/version are you running this on?
- What version of the Dropbox API library do you have installed?
- What's the code that causes this exception?
Thanks in advance! - Greg-DB9 years ago
Dropbox Community Moderator
Also, please share your project.json. Thanks! - Dan C.109 years agoExplorer | Level 4
Hi. Thank you for your very quick reply!
I've found the issue. It was because when I created the project, it had this in the project.json
"frameworks": { "netstandard1.6": { "imports": "dnxcore50" } }So that was saying that my assembly targets netstandard 1.6, but the 'imports' bit is telling it to lie to the compiler saying that dependencies targeting dnxcore50 will work. Hence why it compiled, but fell over at runtime.
I've fixed the issue by just targeting dnxcore50 instead.
- Dan C.109 years agoExplorer | Level 4
It would be great if Dropbox API targetted the latest dotnet standard though :)
- Qiming Y.9 years ago
Dropbox Staff
You can still have your library target .NET standard. The SDK package contains a PCL version which is compatible with .NET standard. What you need to do is change imports from dnxcore50 to portable-net45+win8 and add Microsoft.NETCore.Portable.Compatibility as dependency. - Dan C.109 years agoExplorer | Level 4
Brilliant! This works perfectly. Thanks a lot for your help! :)
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.
If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X, Facebook or Instagram.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!