-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Type Load Exception on Windows 8 Phone when calling WebSocket constructor #2
Comments
Might be because System.Net.EndPoint in .NET 4.0 does not support WP8, WP8 Silverlight, but .NET 4.5 does? |
I have built the downloaded Xamarin.Socket.IO project targeting .Net 4.0 and 4.5 and neither fixes the above error. |
As it appears that MonoTouch assemblies are in the lib folder when I download it I read your answer as meaning that I had to build the WebSocket assembly as .net 4.5? I am new to cross version / platform / portable development so hopefully I am making a simple newbie error. I have tried getting and building the source code for the Super Socket Client Engine and WebSocket4Net references and building these as both .Net 4.0 and 4.5 assemblies. I created two new projects (4.0 and 4.5 PCLs) and added the NuGets and code files from Xamarin.Socket.IO and added references to the relevant outputs from the previous step. This gives Type/Namespace could not be found build errors for WebSocket4Net and WebSocket - which traces back to needing mscorlib... "The primary reference "WebSocket4Net" could not be resolved because it has an indirect dependency on the framework assembly "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" which could not be resolved in the currently targeted framework. ".NETPortable,Version=v4.0,Profile=Profile328". To resolve this problem, either remove the reference "WebSocket4Net" or retarget your application to a framework version which contains "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"." If I update the WebSocket4Net reference in either of the new projects to the WebSocket4Net MonoTouch dll again I get another build error similar to the above, but at build time rather than run time: "The type 'System.Net.EndPoint' is defined in an assembly that is not referenced. You must add a reference to assembly 'System, Version 2.0.50..." Can you expand on your answer a little as whilst I appreciate why that explains the problem I am not sure how to get past it in order to have a single PCL code base (via a sibling csproj to build against 4.5 as well as 4.0) that will work for all windows desktops and mobile? A fallback might be to abstract the SocketIO class and have each view construct and inject this via an IoC container? |
I can't help you, sorry. I am at best a novice developer, but the errors you are experiencing are targeting and framework conflicts. I have happened upon the same issues several times and more often just given up than actually ending up resolving them. The only way I've managed to get projects compiling that where previously targeted to different frameworks is to create a new solution in Visual Studio for the specific framework I need, then add all the files needed to the project, compile -> fix bugs/change types -> compile and hope for the best. Sorry I can't be of any more help. |
Hi,
A friend and I recently downloaded the Xamarin.Socket.IO library and updated it for changes made to the SocketIO / EngineIO protocols since this was last updated and we reference this in our API (C# .Net 4.0 Portable Class Library). Our code changes have been very light touch, no other types or libraries have been added.
We then reference our API PCL in various View projects (Wpf, and Xamarin initially). It works like a dream in the Wpf app and the Android App but when we test the Windows Phone 8 app, we get the following exception in SocketIO::ConnectAsync(string query) when the following line of code executes: WebSocket = new WebSocket (websocketUri);
A first chance exception of type 'System.TypeLoadException' occurred in WebSocket4Net.MonoTouch.DLL
Could not load type 'System.Net.EndPoint' from assembly 'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e'.
Regards,
DCM
The text was updated successfully, but these errors were encountered: