Closed SirSparkles closed 2 years ago
System.AggregateException: One or more errors occurred. --->
System.NullReferenceException: Object reference not set to an instance of an object.
at TMDbLib.Rest.RestResponse.Dispose()
at TMDbLib.Rest.RestRequestExtensions.
--- 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 TMDbLib.Client.TMDbClient.
--- 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 TMDbLib.Client.TMDbClient.
--- End of inner exception stack trace --- --->
(Inner Exception #0) System.NullReferenceException: Object reference not set to an instance of an object.
at TMDbLib.Rest.RestResponse.Dispose()
at TMDbLib.Rest.RestRequestExtensions.
--- 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 TMDbLib.Client.TMDbClient.
--- 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 TMDbLib.Client.TMDbClient.
<--- ---> (Inner Exception #1) System.NullReferenceException: Object reference not set to an instance of an object.
at TMDbLib.Rest.RestResponse.Dispose()
at TMDbLib.Rest.RestRequestExtensions.
--- 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 TMDbLib.Client.TMDbClient.
--- 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 TMDbLib.Client.TMDbClient.
<---
I have the same issue.
System.NullReferenceException
HResult=0x80004003
Mensaje = Object reference not set to an instance of an object.
Origen = TMDbLib
Stack trace:
at TMDbLib.Rest.RestResponse.Dispose()
at TMDbLib.Client.TMDbClient.
I just realized that checking if its null before disposing the response in RestResponse.Dispose() solves the problem. I dont know why is getting disposed before that.
[SuppressMessage("IDisposableAnalyzers.Correctness", "IDISP007:Don't dispose injected.", Justification = "RestResponse owns the response")]
public virtual void Dispose()
{
Response?.Dispose(); // <--there
}
Well, if it's null, it's always been null - so it must be null when it's in the ctor.
Ok, so I can see that the rest client will return null in some cases, like 404 - which then yields an !IsValid
rest response, which then cannot be disposed. That's a woops.
I have pushed 1.9.2
which includes the null check proposed by @carlosmanri - hope this works out for all of you :)
Recently there has been a flurry of NREs coming out of the interface. All from the Dispose() method:
TMDB:929282 [Halo: The Fall of Reach]
System.NullReferenceException: Object reference not set to an instance of an object. at TMDbLib.Rest.RestResponse.Dispose() at TMDbLib.Client.TMDbClient.d__140.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 TMDbLib.Client.TMDbClient.d__139.MoveNext()