In order to get this to work, the assembly containing this code must be grant trust to System.Core. We've modified the templates for DevForce 2010 to do this automatically.
For DevForce 2009 and for any new client assemblies you may create (in either product), you will need to add the following assembly level attribute (to AssemblyInfo.cs):
[assembly: InternalsVisibleTo("System.Core, PublicKey=00240000048000009400000006020000002400005253413100040000010001008d56c76f9e8649383049f383c44be0ec204181822a6c31cf5eb7ef486944d032188ea1d3920763712ccb12d75fb77e9811149e6148e5d32fbaab37611c1878ddc19e20ef135d0cb2cff2bfec3d115810c3d9069638fe4be215dbf795861920e5ab6f7db2e2ceef136ac23d5dd2bf031700aec232f6c6b1c785b4305c123b37ab")]