This project has moved and is read-only. For the latest updates, please go here.

twitterCtx.NewDirectMessage Parentheses error

Nov 19, 2012 at 8:07 PM

Hi, when I pass Parentheses in the message I get a non-specific error. Can you please reproduce or suggest a solution?


Nov 20, 2012 at 12:59 AM


Please post an example of the query you're having a problem with - also include exception details.

I recently fixed a bug where some characters weren't being encoded properly, which is part of the most recent release. If you aren't using the latest release, this might be something to try.

When looking at the exception message, look at the Response property of the TwitterQueryException, if available, to see what Twitter is returning.


Nov 20, 2012 at 6:52 PM


Here is the code -

var message = twitterCtx.NewDirectMessage(userId, "Test message with (parentheses)");

I'm using the latest build.

The error I get is "Could not authenticate you". When I remove the "(" and ")", it works fine.


Nov 21, 2012 at 12:50 AM

I'm not getting an error. I'm still thinking that it's an encoding issue. Here's what Fiddler shows when I send it:

   POST HTTP/1.1

Please run this again and show me the first line of the Request from Fiddler, as I did above. Be sure to not include the Authorization header.

Also, what locale are you?  I'm en-US.


Nov 27, 2012 at 7:29 PM

Joe, sorry, haven't had time to test this in fiddler yet.. Will post my response soon. However simply clicking on the link above gives me this and I'm in en-US -

{"errors":[{"message":"Bad Authentication data","code":215}]}
Nov 27, 2012 at 11:15 PM

No problem - if you find anything more that helps reproduce the problem, let me know.

All Twitter queries require OAuth authentication - so the error you received by clicking that link, which is an unauthenticated query, makes sense.


Dec 17, 2012 at 4:26 AM

I recently ran into a problem with certain characters being unescaped by the Uri class in .NET 4.5, including parenthesis. This sounds very similar to your problem.  Are you using .NET 4.5? 

After doing everything I can to work around it, including config file settings that don't work and reflection hacks, I submitted this to Microsoft connect:

Hopefully, I'll get a quick work-around or explanation.