This project is read-only.

Exception when no results are found with MovieSearch

Jan 5, 2012 at 10:26 PM


I'm using Visual Studio 2010 to write a vb.NET application that uses TheMovieDB api.
When any result is found on a search, the application runs fine.
When no results are found when searching for a movie, i get an exception on Tmdb.MovieSeach().
I use code below to search for a movie.

Dim Tmdb As New TmdbApi("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx")
Dim Movies As List(Of TmdbMovie) = Tmdb.MovieSearch("Blabla")

Exception (when no results are found) :
NL - "Status Element wordt verwacht.. Text met naam , naamruimte  is aangetroffen."
EN - "Status element is expected.. Text with name, namespace is found."

I also tried with another declaration of the 'Movies' variable, but then i get an exception on every search.

Dim Tmdb As New TmdbApi("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx")
Dim Movies() As TmdbMovie = Tmdb.MovieSearch("Blabla")

Exception (on every search):
NL - "Kan een object van het type TheMovieDb.TmdbMovies niet converteren naar het type TheMovieDb.TmdbMovie[]."
EN - "Cannot convert the object of type TheMovieDb.TmdbMovies to type TheMovieDb.TmdbMovie[]."

Could anyone tell me how to declare the Movies variable correctly in vb.NET ?
Or is there any vb.NET documentation on the API ?

Thanks for helping me out.

Jan 10, 2012 at 8:23 PM

This seems to be a problem across the board when no results are returned from the API.  There's a method in TmdbApi called DownloadData that makes the service calls and deserializes the results into the appropriate type.  When the results aren't valid, deserialization fails and the exception is throw.  I'm looking into figuring out a more graceful way to handle no results and will submit a patch here shortly.

Jan 11, 2012 at 7:23 AM

Thanks for your reply.
I will wait for the patch.

Jan 12, 2012 at 5:00 PM
dietervd wrote:

Thanks for your reply.
I will wait for the patch.

I submitted the patch.  You can grab it from

Jan 12, 2012 at 9:14 PM

Thank you, the patch works.
When no movie is found, the MovieSearch function returns "Nothing".