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

Cannot get WinRT support working at all in demos or source

Apr 26, 2013 at 8:19 AM
I tried the demo that fails with unauthorized (see my issue I posted - the typical issues in the FAQ don't seem to apply)

I then downloaded the latest code and run it with that (rather than the nuget installed binaries) and I get farther, but it bombs out in LinqToTwitter.OAuthAuthorizer on line 163
        request.Headers["user-agent"] = UserAgent;
The exception is:
The 'user-agent' header must be modified using the appropriate property or method.

Which is interesting as in Visual Studio that line is grayed out because of the compile constants not being set, but at run time it hits that code. If I step over that line I then eventually get 400 - Bad Authentication Data (I've set my keys, get prompted for login by twitter, its only when I go back to I'm assuming enter in the code does this happen)

I work for Microsoft and am interested in using this on an internal project. Any help is much appreciated. Thanks!
Apr 26, 2013 at 8:43 AM
Followup - I changed my callback URL from None to http://application.local on I then changed the Callback to

Callback = Windows.Security.Authentication.Web.WebAuthenticationBroker.GetCurrentApplicationCallbackUri(),

I'm not sure if that makes any difference though as it's already set in the app settings on

I then removed all the source and reinstalled the NuGet package. Now the demo works. So the next question would be are there any special compilation instructions? When I use the source, it fails (See the above post)

Awesome project btw - thanks!
Apr 26, 2013 at 3:26 PM

I need to update the demos. Twitter recently changed their handling of OAuth, and the latest download and NuGet packages have the fix, which might have been part of the problem. Here's my FAQ, that includes a section on 401 - one of the suggestions being what you did to set a URL on

I'm building the project with Visual Studio 2012. In the area where you're seeing the problem, there are multiple defines to differentiate between the supported technologies, each handling setting of standard headers in different ways. If you open that OAuthAuthorizer to line 163 through the LinqToTwitterRT project, you'll see that it isn't grayed out. However, it compiles for me. I wonder what's different.

Jun 16, 2013 at 2:43 PM

i was having a similar problem using the latest NugetPackage - getting "The 'user-agent' header must be modified using the appropriate property or method."-Error.

Using the build that's used in the Win-RT sample it works.
Jun 18, 2013 at 11:25 PM

That's a known issue that I've fixed. The work-around right now is to download the source code and use the DLLs from the LinqToTwitterRT project. Any 2.1.x.x version should work. I have a couple items to take care of before doing another release.

Jul 3, 2013 at 4:58 PM
I'm working with version in silverlight and actually getting a similar error:

The 'User-Agent' header cannot be modified directly.
Parameter name: name

Any ideas?
Jul 3, 2013 at 5:07 PM
Sounds similar to this issue:

I'll have to double-check to see if it's fixed for Silverlight too. I'm tied up right now and it might take a couple days before I get to it.