Tweetinvi.TweetinviConfig.CURRENT_WEB_REQUEST_TIMEOUT = 60000;
Tweetinvi.TweetinviConfig.CURRENT_PROXY_URL = "127.0.0.1....";
var settings = new Tweetinvi.Core.TweetinviSettingsAccessor();
// confirmed is correct settings.CurrentThreadSettings.ProxyURL
This is all set, stepped through, is all working correctly.
Actions are run using:
TwitterCredentials.ExecuteOperationWithCredentials(cred, () =>
yet, when responding to a stream notification, the settings information is dropped!
After making a call to the API
This code runs:
Method: public HttpResponseMessage GetResponseMessageFromWebRequest(WebRequest webRequest)
var requestTask = TaskEx.Run(() => GetResponseMessageFromWebRequestAsync(webRequest, _tweetinviSettingsAccessor.WebRequestTimeout));
Just before stepping in, the
is correct, my settings are in, but when I step in, the settings are null and are override
after the callback runs, I am back in the code, my current settings are there, then this line runs
var resultingTask = TaskEx.WhenAny(requestTask, TaskEx.Delay(_tweetinviSettingsAccessor.WebRequestTimeout)).Result;
again, just before, currentthreadsettigns correct, callback executes, settings gone - overidden
So from what I can tell, the async, callback nature of it all, is running things in different "threads" or whatever the terminology and ignoring how other parts of the program function, by having to assign the details to the executing thread, which
will detect it later when required and use the parameters.
Any definite ideas on what is going on here? tbh I am a bit lost in it all - and probably is me not understanding things and doing it wrong. The whole paradigm of assigning variables to the executing thread is very different to how I normally do things (assign
properties to the object and pass that to execute it), so I am probably trying to do things with the wrong mindset :-s