Skip to content
This repository has been archived by the owner on Nov 24, 2020. It is now read-only.

System.NullReferenceException When getting popular shows #59

Closed
tidusjar opened this issue Apr 28, 2017 · 9 comments
Closed

System.NullReferenceException When getting popular shows #59

tidusjar opened this issue Apr 28, 2017 · 9 comments

Comments

@tidusjar
Copy link

Version: 1.0.0-alpha1

Example code:


        public TraktClient Client = new TraktClient(_apiKey);

        public async Task<IEnumerable<TraktShow>> GetPopularShows(int? page = null, int? limitPerPage = null)
        {
            var popular = await Client.Shows.GetPopularShowsAsync(new TraktExtendedInfo { Full = true }, null, page ?? 1, limitPerPage ?? 10);
            return popular.Value;
        }

Exception:

System.NullReferenceException: Object reference not set to an instance of an object.
   at TraktApiSharp.Requests.Handler.TraktRequestHandler.<ExecuteRequestAsync>d__29.MoveNext() in C:\projects\traktapisharp\Source\Lib\TraktApiSharp\Requests\Handler\TraktRequestHandler.cs:line 254
--- 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 TraktApiSharp.Requests.Handler.TraktRequestHandler.<QueryPagedListAsync>d__28`1.MoveNext() in C:\projects\traktapisharp\Source\Lib\TraktApiSharp\Requests\Handler\TraktRequestHandler.cs:line 244
--- 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 TraktApiSharp.Requests.Handler.TraktRequestHandler.<ExecutePagedRequestAsync>d__16`1.MoveNext() in C:\projects\traktapisharp\Source\Lib\TraktApiSharp\Requests\Handler\TraktRequestHandler.cs:line 0
--- 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 TraktApiSharp.Modules.TraktShowsModule.<GetPopularShowsAsync>d__17.MoveNext() in C:\projects\traktapisharp\Source\Lib\TraktApiSharp\Modules\TraktShowsModule.cs:line 488
--- 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 Ombi.Api.Trakt.TraktApi.<GetPopularShows>d__6.MoveNext() in C:\Users\Jamie.Rees\Source\Repos\PlexRequests.Net\Ombi\Ombi.Api.Trakt\TraktApi.cs:line 26
--- 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 Ombi.Core.Engine.TvSearchEngine.<Popular>d__17.MoveNext() in C:\Users\Jamie.Rees\Source\Repos\PlexRequests.Net\Ombi\Ombi.Core\Engine\TvSearchEngine.cs:line 51
--- 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 Ombi.Controllers.SearchController.<PopularTv>d__17.MoveNext() in C:\Users\Jamie.Rees\Source\Repos\PlexRequests.Net\Ombi\Ombi\Controllers\SearchController.cs:line 71
--- 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.ObjectMethodExecutor.<CastToObject>d__40`1.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.<InvokeActionMethodAsync>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.<InvokeNextActionFilterAsync>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.<InvokeNextResourceFilter>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.<InvokeAsync>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.<Invoke>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.Authentication.AuthenticationMiddleware`1.<Invoke>d__18.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware`1.<Invoke>d__18.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.Extensions.MapMiddleware.<Invoke>d__3.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.DeveloperExceptionPageMiddleware.<Invoke>d__7.MoveNext()

@henrikfroehling
Copy link
Owner

Fix will be available in version 1.0.0-alpha2.
Binaries are available here.

henrikfroehling added a commit that referenced this issue May 3, 2017
Fix HttpClient with null value in request handler. Fixes #59
@tidusjar
Copy link
Author

tidusjar commented May 3, 2017

Oh wow excellent. Any idea when you plan to push a new nuget package up?

@henrikfroehling
Copy link
Owner

henrikfroehling commented May 3, 2017

There are currently some ci-build breaking major changes ongoing. My goal is to release the next version (1.0.0-alpha2) probably end of May / begin of June.

Sometime during May, I will release version 0.10.0 with fixed issues #54 and #55.

@tidusjar
Copy link
Author

tidusjar commented May 3, 2017

Ok excellent, I'll just run with direct references to the binaries for now.

Nice job with this library, the code is clean and easy to work with!

@henrikfroehling
Copy link
Owner

Thank you very much. That is my primary goal. :-)
The next major version (1.0.0) will be a lot more based on interfaces, which allows for simpler customization of Trakt API objects.

Let me know if there are any other issues.

@tidusjar
Copy link
Author

tidusjar commented May 4, 2017

When referencing the assembly from the AppVeyor build you linked, it seems like it's targeting .Net 4.6. So when referencing from a .Net Core project it's throwing FileNotFoundException: Could not load file or assembly could not find the file

@henrikfroehling
Copy link
Owner

@tidusjar I'll look into it.

@henrikfroehling
Copy link
Owner

@tidusjar I can't reproduce the error. All is workling as it should, either by directly referencing the assembly or referencing the NuGet package (which I created manually).

netcoreconsoleapp

Nonetheless, you can find the NuGet package here and the example .NET Core Console project here.

@tidusjar
Copy link
Author

tidusjar commented May 4, 2017

Interesting. Thank you for looking into this. I'll give it another go!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
No open projects
Version 1.0.0
  
Done
Development

No branches or pull requests

2 participants