4

when using the new Universal Windows Platform and a SignalR client (from Nuget) a strange thing happens when you set the network credential.

The following code works flawlessly:

NetworkCredential Connection_Credentials = new NetworkCredential( "Name", "Password" );
Microsoft.AspNet.SignalR.Client.Connection Connection = new Microsoft.AspNet.SignalR.Client.Connection( "http://localhost/Bla" );

However when you assign the NetworkCredential in the following way the runtime crashes even before executing the code:

NetworkCredential Connection_Credentials = new NetworkCredential( "Name", "Password" );
Microsoft.AspNet.SignalR.Client.Connection Connection = new Microsoft.AspNet.SignalR.Client.Connection( "http://localhost/Bla" );
Connection.Credentials = Connection_Credentials;

The error is: "System.IO.FileNotFoundException: Could not load file or assembly 'System.Net, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes' or one of its dependencies. The system cannot find the file specified.\r\n at UAP2.MainPage.Page_Loaded(Object sender, RoutedEventArgs e)"

Is this an error I can fix myself (I tried doing the same with another project) or is there a problem in the SignalR package (or one of it's dependencies?).
Why would it want to reference 2.0.5.0 of System.Net and not a 4-* version?

6
  • Is it a new universal store app project or you are upgrading changing an existing project? 2.0.5.0 indicates Silverlight (or Siverlight based WP app).
    – Pawel
    May 1, 2015 at 18:52
  • 1
    Instead of tagging very generic terms like .net or uap, you'd get better results tagging this visual-studio-2015.
    – BCdotWEB
    May 2, 2015 at 16:54
  • 1
    @zeroskyx I will take a look at this on Monday.
    – Pawel
    May 2, 2015 at 17:45
  • 1
    Can't even build an UAP. Tried on two different boxes. Windows SDK is installed but VS is saying "Could not find SDK "Microsoft.NET.CoreRuntime, Version=1.0". I tried yours and also created a new one - the same result. Sorry.
    – Pawel
    May 4, 2015 at 20:21
  • 1
    Same Problem here. Added an UAP project to an existing and working solution, where I was able to write a Windows 8.1 Universal app without problems. Getting the same exception. Also, we tried with a fresh UAP project, same result. .
    – MSicc
    May 6, 2015 at 14:56

3 Answers 3

3

it's a bit crude, but I have found a fix/workaround. Basically you have to make sure you use the assembly from the WinRT project in stead of the two that NuGet attaches. See http://dotnetbyexample.blogspot.nl/2015/05/getting-signalr-clients-to-work-on.html for details

3

I don't have the answer to the problem, but I reported an issue about it on GitHub. Hopefully someone will finally look into it.

https://github.com/SignalR/SignalR/issues/3483

Edit:

Did some testing with the source code of SignalR.Client and it crashes in its DefaultHttpHandler(IConnection connection) constructor. Most likely when in System.Net.Http.HttpClientHandler constructor (for which I don't have source code).

0

A workaround for this should be to compile the SignalR client DLL without support for SL5 - targeting .NET 4.5, Windows 8, Windows Phone Silverlight 8, and Windows Phone 8.1, also known as PCL Profile 259.

1
  • Like I already wrote on Github, this results in an over all unbuildable project as too many dependencies get broken.
    – MSicc
    May 15, 2015 at 17:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.