Rx 2.1 is available on NuGet!


To follow up on our announcement of releasing Rx 2.1, we’d like to let you know what changed in this release.

We have updated the Reactive Extensions for .NET, primarily to re-enable Windows Phone 8 support.  We ran into a bug with a partner team’s tooling and the strong name crypto key we use to sign Rx.  To work around the problem, we had to change the crypto key back from a SHA-2 key to the SHA-1 key we used with Rx previously.  This affected our portable library and other flavors of Rx, so we recommend that you download a new version and recompile everything that depends on Rx. 

Additionally, we have decided to simplify our distribution story for developers.  Rx 2.1 binaries are available only on NuGet.  You can easily get this in Visual Studio by right clicking in your project’s References tab and selecting “Manage NuGet packages…” then typing Rx in the search box.  Alternately, you can go to NuGet.org and use their package manager to install Rx on the command line if you desire.  Or you can grab the source from CodePlex and run with it.

Beyond the new strong name key, we’ve made a few minor additions:

*) Added several SelectMany overloads that provide you with indices, so you know which element in an IObservable or IEnumerable you’re dealing with.  The simple overloads look like this:

 IObservable<TResult> SelectMany<TSource, TResult>(
    IObservable<TSource> source,
    Func<TSource, int, IObservable<TResult>> selector);

The more complex ones look like this:

 IObservable<TResult> SelectMany<TSource, TCollection, TResult>(
    IObservable<TSource> source,
    Func<TSource, int, IObservable<TCollection>> collectionSelector,
    Func<TSource, int, TCollection, int, TResult> resultSelector);

*) Added helper methods for dealing with anonymous types.  If you want to create instances of a generic type using an anonymous type as the type argument, that’s not expressible in some languages like C#.  Instead, we can create a static generic method on a non-generic type that serves as a factory method and uses type inference to work around the lack of any name for the anonymous type.  Consider the following illegal and legal examples:

 DateTimeOffset time = ...;
var anonType = new { x = 5, y = "hi" };
var v = new Timestamped<typeof(anonType)>(anonType, time); // illegal
var v = Timestamped.Create(anonType, time); // legal

We used the anonymous type trick while testing SelectMany too!

Enjoy!


Comments (18)

  1. Cory Nelson says:

    Thanks for your continued work on Rx!

  2. Benjamin says:

    Nice job.

    One thing however, I can't find the extension methods to transform IAsyncAction into IObservable on Windows Phone 8.

    Thanks,

  3. Thank you!

    But I still can't use it with portable libraries.

    You are trying to install this package into a project that targets 'portable-win+net45+sl40+wp71', but the package does not contain any assembly references or content files that are compatible with that framework.

  4. Benjamin says:

    I think the portable version is for portable-win+net45+wp80

    It doesn't support SL and WP7.5

  5. Benjamin, thanks for pointing out that we missed WinRT support for Windows Phone 8.  We overlooked this, and we're looking at how to best add this support.

    Vladislav, Rx's portable library support was targeted at the set of platforms where we could get the most value.  Unfortunately some of the older platforms don't quite support enough functionality, so the value from providing a portable library is greatly diminished.  Perhaps you could take a dependency on the Silverlight 4 version of Rx, or reconsider your needs for Silverlight 4.  

    You can read more about the architectural decisions that went into our portable library factoring in the following blog post from last March:

    blogs.msdn.com/…/reactive-extensions-v2-0-beta-available-now.aspx

  6. What happened to AsQServableI()?  Got to love it when NuGet updates break compiling code right before a release :(

    Where can we find a complete release note?

  7. Sorry I meant AsQbservable not AsQServable.  Anyway, uninstalling the NuGets, doing a clean and reinstalling them fixed the issue.

  8. Vitaliy says:

    Hey guys,

    Where is RX download for Silverlight 4? Your install (including NuGet) includes only SIlverlght 5 libs….

    We still use Slv4…

  9. Thanks for the feedback on our NuGet packages guys.  We've just re-released Rx with changes you've asked for here.

    1) Added our WinRT assembly to the Windows Phone 8 build.

    2) Adjusted some Windows Phone 8 #ifdefs to better reflect what's in that OS

    3) Added Silverlight 4 to our NuGet packages.

    Sorry for the problems, and thanks for your feedback.  Look for the NuGet packages with the version number 30214.

  10. Brad Cunningham says:

    I still can't seem to install the nuget package (2.1.30214.0) as a reference to my Portable Class Library.

    I have tried all kinds of combinations of PCL support in my library and it always just fails.

    As I understand it, with the latest package I should be able to support.

    .NET 4.0

    WinPhone 8

    Silverlight 4 and higher

    .NET for Windows Store apps

    Can you confirm this? Or can you post specifically what libraries I can support in my PCL project with the latest NuGut package? I can't get it to work no matter what I select it seems.

  11. Pagey says:

    I have a similar problem to Brad…

    The install of Reactive Extensions – Interfaces Library 2.1.30214.0 fails with the error:

    Install-Package : Could not install package 'Rx-Interfaces 2.1.30214.0'. You are trying to install this package into a project that targets 'WindowsPhone,Version=v8.0', but the

    package does not contain any assembly references that are compatible with that framework. For more information, contact the package author.

    At line:1 char:1

    + Install-Package Rx-Interfaces

    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

       + CategoryInfo          : NotSpecified: (:) [Install-Package], InvalidOperationException

       + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand

    Now my portable library has the following target frameworks:

    .NET 4.5

    WinPhone 8

    NET for Windows Store apps

    Any help would be greatly appreciated,

    Thanks in advance.

  12. jlaanstra says:

    @Brad Silverlight is not supported in the portable cass library for Rx, since IObservable and IObserver live in different assemblies as mentioned here blogs.msdn.com/…/reactive-extensions-v2-0-beta-available-now.aspx.

    @Pagey: Make sure your NuGet is up to date. NuGet package manager support Windows Phone 8 since version 2.1 as explained here docs.nuget.org/…/nuget-2.1. Just check extensions and updates in the tools menu in Visual Studio.

  13. jlaanstra says:

    Rx team can you please take a look at this discussion item on codeplex I just created? rx.codeplex.com/…/434274

    This would make using Rx a little easier. :)

  14. Pagey says:

    Bonza. Thanks very much jlaanstra!

    That did the trick :)

  15. Viacheslav says:

    Hello. I try to install RX to my portable library, that targetting to WP7 + WinRT applications. But I get an error:

    "Could not install package 'Rx-Interfaces 2.1.30214.0'. You are trying to install this package into a project that targets 'portable-win+net45+sl40+wp71', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author."

    Please fix this issue.

  16. @Viacheslav, I think you were having the same issue as Pagey. Try installing NuGet 2.1 which has support for Windows Phone 8: docs.nuget.org/…/nuget-2.1

  17. @RxTeam

    Please add a portable library which can be use to target additional platforms such as Silverlight and.Net 4.0.

    @jlaanstra  

    It is definitely possible to work around to issue of IObservable only being available on certain platforms and I have added a pull request which shows how to do this at codeplex (Irx.codeplex.com/…/4516).

    As for wp7 support I don't know how to achieve it due to lack of the TypeForwardedToAttribute, but maybe you can get some help from the portable library team.

    Unless wp7 can be fixed I think the following portable builds would be great to have in order to provide an as portable implementation as possible:

    * portable-win+net40+sl4+wp8

    * portable-win+net40+sl5+wp8 – (By looking at the code Action is not contravariant in Sl4 but is so in SL5)

    Since the number of platforms increases you might want to start to think about using portable builds of at least some of the assemblies when targeting a specific platform (at least the interfaces assemblies of the above targets should be fully compatible with sl4 and sl5 respectively)

  18. Hank says:

    So….It's December 2013, and 2.2 is released….and the 2.1 release post from forever ago is the last post in your blog.

    Yeah, so that happened.