Hello,
Maybe this is a strange requirement but I'm running into a bug of some sort when trying to run Tweetinvi in a self hosted WCF application. Running the SearchJson version of SearchTweets once or twice will work, but the second or third time will always give an exception of the type below. I cannot trigger it using the same code in a regular console app. It seems to happen more often with the debugger attached? I have pasted my code below.
If you are interested in looking at this but don't have WCF experience I could send you a sample solution.
An exception of type 'System.NullReferenceException' occurred in Tweetinvi.dll but was not handled in user code
System.NullReferenceException was unhandled by user code
HResult=-2147467261
Message=Object reference not set to an instance of an object.
Source=Tweetinvi
StackTrace:
Maybe this is a strange requirement but I'm running into a bug of some sort when trying to run Tweetinvi in a self hosted WCF application. Running the SearchJson version of SearchTweets once or twice will work, but the second or third time will always give an exception of the type below. I cannot trigger it using the same code in a regular console app. It seems to happen more often with the debugger attached? I have pasted my code below.
If you are interested in looking at this but don't have WCF experience I could send you a sample solution.
An exception of type 'System.NullReferenceException' occurred in Tweetinvi.dll but was not handled in user code
System.NullReferenceException was unhandled by user code
HResult=-2147467261
Message=Object reference not set to an instance of an object.
Source=Tweetinvi
StackTrace:
at Tweetinvi.Json.SearchJson.SearchTweets(String searchQuery)
at Backfill.Backfiller.Backfill() in c:\Code\TweetInviBugDemo\Backfill\Backfiller.cs:line 14
at SyncInvokeBackfill(Object , Object[] , Object[] )
at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs)
at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc)
Here is the code:using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Backfill
{
[ServiceContract]
public interface IBackfill
{
[WebInvoke(Method = "GET", BodyStyle = WebMessageBodyStyle.Wrapped)]
[OperationContract]
void Backfill();
}
class Backfiller: IBackfill
{
public void Backfill()
{
Tweetinvi.TwitterCredentials.SetCredentials("your", "credentials", "go", "here");
var tweets = Tweetinvi.Json.SearchJson.SearchTweets("test");
}
}
}