GetUsersFromNames Value cannot be null issue

Aug 27, 2014 at 10:10 PM
Edited Aug 27, 2014 at 10:12 PM
Hi Linvi

Im having an issue with GetUsersFromNames always returning null. I have a function that gets a list of user names

IEnumerable<string> users = connection.GetRecentUsers();

The funtion is returning the a list of usernames

and when I execute

IEnumerable<IUser> userCollection = User.UserFactory.GetUsersFromNames(users);

I get the following error
Value cannot be null.
Parameter name: collection

The getrecentusers function is just hardcoded at the moment

public IEnumerable <string> GetRecentUsers()

    List<string> list = new List<string>();
    IEnumerable<string> users = list.AsEnumerable();

    return users;

When I run the same code with a list of user IDs returned I can use the GetUsersFromIDs function without any issue and id prefer to use this method but the tweetinvi API doenst expose the user ID from the tweetDTO so I only have access to usernames at the moment.

Aug 27, 2014 at 11:19 PM

I am not sure what you are doing wrong but this is working perfectly well here.
I have also added a method to the static User class so that you no longer need to use the UserFactory in which is coming soon.
It will also be renamed to GetUsersFromScreenNames.

Here is the code I am using :
var userScreenNames = new[] {"blindasfcuk"};
var user = User.UserFactory.GetUsersFromNames(userScreenNames);
Aug 27, 2014 at 11:52 PM
Ya that doesnt work either. Just fired up fiddler there to check out the traffic to twitter and its actually retuning a 404 page not found message. That screen name definitely exists as its the test one ive set up and when I use the user id it returns the data correctly.
Aug 28, 2014 at 10:09 PM
What would I need to make some changes to the API to add some features for myself? If I want to make changes to the DTO code for tweets Im assuming I can just launch the Tweetinvi.Logic project make the changes and rebuild the dll. Or am I way off? Just looking at the code I can see it was created in visual studio 2013 so Ill probably need to upgrade my visual studio so I want to make sure Im on the right track first
Aug 28, 2014 at 11:33 PM
I am not sure what is going wrong with your code. It seems perfectly alright.

Concerning the modification of Tweetinvi you can just update the Tweetinvi.Logic project as you said and rebuild it.
I am using Visual Studio 2013 but the project should work in Visual 2012.

Just by curiosity, what are you trying to change in the DTOs?

Aug 29, 2014 at 1:28 PM
Edited Aug 29, 2014 at 1:57 PM
I was planning on exposing the user id field from the user info provided in the tweet but I just noticed that the IUser interface creates an IUserDTO object whos class inherits from IUserIdentifier which has the as user ID field within so I should already be able to get the user ID string is that correct?

Any example on how I can get at that field from a tweet object? Would it be something like this
stream.TweetReceived += (sender, args) =>
     var tweet = args.Tweet;
Console.WriteLine("{0} from user {1} was detected ", tweet.Id,;