I’ve already filed the bug as case #917766
-
Copy System.ServiceModel.Web.dll from [Unity Install Location]\Editor\Data\Mono\lib\mono\2.0 into your project
-
Have simple script use SyndicationFeed, such as:
using System.IO;
using System.Linq;
using System.Net;
using System.ServiceModel.Syndication;
using System.Xml;
using UnityEngine;
public class FeedTest : MonoBehaviour
{
void Start()
{
string url = "https://www.nuget.org/api/v2/FindPackagesById()?$orderby=Version asc&id='Owin'&$filter=Version ge '1.0'";
// Mono doesn't have a Certificate Authority, so we have to provide all validation manually. Currently just accept anything.
// See here: http://stackoverflow.com/questions/4926676/mono-webrequest-fails-with-https
ServicePointManager.ServerCertificateValidationCallback = null;
ServicePointManager.ServerCertificateValidationCallback += (sender, certificate, chain, policyErrors) => true;
HttpWebRequest getRequest = (HttpWebRequest)WebRequest.Create(url);
getRequest.Timeout = 5000;
getRequest.ReadWriteTimeout = 5000;
Stream responseStream = getRequest.GetResponse().GetResponseStream();
SyndicationFeed feed = SyndicationFeed.Load(XmlReader.Create(responseStream));
Debug.Log(feed.Items.First().Id);
}
}
-
Hit play and everything works fine.
-
Switch to .NET 4.6
Related random bug: Sometimes when switching, Unity can no longer open until the Library folder is deleted -
Hit Play: Exception thrown - TypeLoadException: Could not resolve type with token 01000007
Related info:
The MSDN states that SyndicationFeed was moved from System.ServiceModel.Web.dll (.NET 3.5) to System.ServiceModel.dll (.NET 4.0).
[Unity Beta Install Location]\Editor\Data\Mono\lib\mono\2.0 appears to contain the .NET 2.0/3.5 DLLs
[Unity Beta Install Location]\Editor\Data\Mono\lib\mono\unity I assumed contains the .NET 4.6 DLLs
However, neither System.ServiceModel.Web.dll nor System.ServiceModel.dll in the “unity” folder contain the SyndicationFeed type.
Thus, there appears to be no way to use SyndicationFeed when in .NET 4.6 mode.