The type initializer for 'Tweetinvi.TwitterCredentials' threw an exception while Autofac is 3.3+


i want to retrieve tweets from twitter using specific hashtags. i am using tweetinvi for this purpose.but i am getting an error outer exception:

The type initializer for 'Tweetinvi.TwitterCredentials' threw an exception.
Inner exception:
{"Could not load file or assembly 'System.Core, Version=, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes' or one of its dependencies. The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047)":"System.Core, Version=, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes"}
 i am using autofac 3.4.
kindly point out what am i doing wrong?

              var searchParameterSearch.GenerateTweetSearchParameter("#pakvsSA");
           searchParameter.SetGeoCode(-122.398720, 37.781157, 1,DistanceMeasure.Miles);
           searchParameter.Lang = Language.English;
           searchParameter.SearchType = SearchResultType.Popular;
           searchParameter.MaximumNumberOfResults = 100;
           searchParameter.Until = new DateTime(2015, 12, 3);
           searchParameter.SinceId = 399616835892781056;
           searchParameter.MaxId = 405001488843284480;
           var tweets = Search.SearchTweets(searchParameter);
asked on Stack Overflow Mar 13, 2015 by Azka Gilani • edited Mar 13, 2015 by Lucifer

1 Answer


So it looks like there are some .dll required by Tweetinvi (Sytem.Core) that are missing.

I would strongly advise using nuget to install Tweetinvi as a package as it will automatically install and reference all required dll.

answered on Stack Overflow Mar 23, 2015 by user2465083

User contributions licensed under CC BY-SA 3.0