Search code examples
xamarin.iosxamarin.net-assemblyportable-class-librarypusher

Assembly not found error in Xamarin Studio


Let me first start by saying, I'm not even sure what I'm trying to do is possible, and I'm very new to Xamarin/Monotouch development, but here goes.

For some background, I'm looking for a Xamarin PCL version of a bi-directional Pusher library. I've found an implementation that receives, but doesn't send. I've used the Pusher.net library before in a Windows app, and it worked well, so I figured I'd try to port it. I'm able to import and compile the actual Pusher assembly as a PCL with with no problems. However when I try to build the Pusher.Connections.Net library (again, as a PCL), I get the following error:

Target CoreCompile:
    Tool /Library/Frameworks/Mono.framework/Versions/3.12.0/lib/mono/4.5/mcs.exe execution started with arguments: /noconfig /debug:full /debug+ /optimize- /out:obj/Debug/Pusher.Connections.dll Properties/AssemblyInfo.cs WebSocketConnection.cs WebSocketConnectionFactory.cs /target:library /define:DEBUG /nostdlib /reference:../../../Downloads/WebSocket4Net(0.11)/net45/Debug/WebSocket4Net.dll /reference:../packages/Xamarin.Forms.1.3.1.6296/lib/portable-win+net45+wp80+MonoAndroid10+MonoTouch10+Xamarin.iOS10/Xamarin.Forms.Core.dll /reference:../packages/Xamarin.Forms.1.3.1.6296/lib/portable-win+net45+wp80+MonoAndroid10+MonoTouch10+Xamarin.iOS10/Xamarin.Forms.Xaml.dll /reference:/Users/user/Projects/PusherTest/Pusher/bin/Debug//Pusher.dll /reference:/Library/Frameworks/Mono.framework/Versions/3.12.0/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile78/Microsoft.CSharp.dll /reference:/Library/Frameworks/Mono.framework/Versions/3.12.0/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile78/System.Collections.dll /reference:/Library/Frameworks/Mono.framework/Versions/3.12.0/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile78/System.ComponentModel.EventBasedAsync.dll /reference:/Library/Frameworks/Mono.framework/Versions/3.12.0/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile78/System.ComponentModel.dll /reference:/Library/Frameworks/Mono.framework/Versions/3.12.0/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile78/System.Core.dll /reference:/Library/Frameworks/Mono.framework/Versions/3.12.0/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile78/System.Diagnostics.Contracts.dll /reference:/Library/Frameworks/Mono.framework/Versions/3.12.0/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile78/System.Diagnostics.Debug.dll /reference:/Library/Frameworks/Mono.framework/Versions/3.12.0/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile78/System.Diagnostics.Tools.dll /reference:/Library/Frameworks/Mono.framework/Versions/3.12.0/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile78/System.Dynamic.Runtime.dll /reference:/Library/Frameworks/Mono.framework/Versions/3.12.0/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile78/System.Globalization.dll /reference:/Library/Frameworks/Mono.framework/Versions/3.12.0/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile78/System.IO.dll /reference:/Library/Frameworks/Mono.framework/Versions/3.12.0/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile78/System.Linq.Expressions.dll /reference:/Library/Frameworks/Mono.framework/Versions/3.12.0/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile78/System.Linq.Queryable.dll /reference:/Library/Frameworks/Mono.framework/Versions/3.12.0/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile78/System.Linq.dll /reference:/Library/Frameworks/Mono.framework/Versions/3.12.0/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile78/System.Net.NetworkInformation.dll /reference:/Library/Frameworks/Mono.framework/Versions/3.12.0/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile78/System.Net.Primitives.dll /reference:/Library/Frameworks/Mono.framework/Versions/3.12.0/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile78/System.Net.Requests.dll /reference:/Library/Frameworks/Mono.framework/Versions/3.12.0/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile78/System.Net.dll /reference:/Library/Frameworks/Mono.framework/Versions/3.12.0/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile78/System.ObjectModel.dll /reference:/Library/Frameworks/Mono.framework/Versions/3.12.0/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile78/System.Reflection.Extensions.dll /reference:/Library/Frameworks/Mono.framework/Versions/3.12.0/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile78/System.Reflection.Primitives.dll /reference:/Library/Frameworks/Mono.framework/Versions/3.12.0/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile78/System.Reflection.dll /reference:/Library/Frameworks/Mono.framework/Versions/3.12.0/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile78/System.Resources.ResourceManager.dll /reference:/Library/Frameworks/Mono.framework/Versions/3.12.0/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile78/System.Runtime.Extensions.dll /reference:/Library/Frameworks/Mono.framework/Versions/3.12.0/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile78/System.Runtime.InteropServices.WindowsRuntime.dll /reference:/Library/Frameworks/Mono.framework/Versions/3.12.0/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile78/System.Runtime.Serialization.Json.dll /reference:/Library/Frameworks/Mono.framework/Versions/3.12.0/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile78/System.Runtime.Serialization.Primitives.dll /reference:/Library/Frameworks/Mono.framework/Versions/3.12.0/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile78/System.Runtime.Serialization.Xml.dll /reference:/Library/Frameworks/Mono.framework/Versions/3.12.0/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile78/System.Runtime.Serialization.dll /reference:/Library/Frameworks/Mono.framework/Versions/3.12.0/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile78/System.Runtime.dll /reference:/Library/Frameworks/Mono.framework/Versions/3.12.0/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile78/System.Security.Principal.dll /reference:/Library/Frameworks/Mono.framework/Versions/3.12.0/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile78/System.ServiceModel.Http.dll /reference:/Library/Frameworks/Mono.framework/Versions/3.12.0/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile78/System.ServiceModel.Primitives.dll /reference:/Library/Frameworks/Mono.framework/Versions/3.12.0/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile78/System.ServiceModel.Security.dll /reference:/Library/Frameworks/Mono.framework/Versions/3.12.0/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile78/System.ServiceModel.Web.dll /reference:/Library/Frameworks/Mono.framework/Versions/3.12.0/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile78/System.ServiceModel.dll /reference:/Library/Frameworks/Mono.framework/Versions/3.12.0/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile78/System.Text.Encoding.Extensions.dll /reference:/Library/Frameworks/Mono.framework/Versions/3.12.0/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile78/System.Text.Encoding.dll /reference:/Library/Frameworks/Mono.framework/Versions/3.12.0/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile78/System.Text.RegularExpressions.dll /reference:/Library/Frameworks/Mono.framework/Versions/3.12.0/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile78/System.Threading.Tasks.dll /reference:/Library/Frameworks/Mono.framework/Versions/3.12.0/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile78/System.Threading.dll /reference:/Library/Frameworks/Mono.framework/Versions/3.12.0/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile78/System.Windows.dll /reference:/Library/Frameworks/Mono.framework/Versions/3.12.0/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile78/System.Xml.Linq.dll /reference:/Library/Frameworks/Mono.framework/Versions/3.12.0/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile78/System.Xml.ReaderWriter.dll /reference:/Library/Frameworks/Mono.framework/Versions/3.12.0/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile78/System.Xml.Serialization.dll /reference:/Library/Frameworks/Mono.framework/Versions/3.12.0/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile78/System.Xml.XDocument.dll /reference:/Library/Frameworks/Mono.framework/Versions/3.12.0/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile78/System.Xml.XmlSerializer.dll /reference:/Library/Frameworks/Mono.framework/Versions/3.12.0/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile78/System.Xml.dll /reference:/Library/Frameworks/Mono.framework/Versions/3.12.0/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile78/System.dll /reference:/Library/Frameworks/Mono.framework/Versions/3.12.0/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile78/mscorlib.dll /warn:4
WebSocketConnection.cs(94,27): warning CS1998: Async block lacks `await' operator and will run synchronously
WebSocketConnection.cs(24,14): error CS1684: Reference to type `System.Net.EndPoint' claims it is defined assembly `System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089', but it could not be found
    /Users/user/Projects/PusherTest/Pusher.Connections/../../../Downloads/WebSocket4Net(0.11)/net45/Debug/WebSocket4Net.dll (Location of the symbol related to previous error)
Task "Csc" execution -- FAILED
Done building target "CoreCompile" in project "/Users/user/Projects/PusherTest/Pusher.Connections/Pusher.Connections.Net.csproj".-- FAILED

To save some scrolling, the key error is:

WebSocketConnection.cs(24,14): error CS1684: Reference to type `System.Net.EndPoint' claims it is defined assembly `System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089', but it could not be found

If I open up the assembly browser in Xamarin, it appears the System.dll that's referenced does indeed have the Endpoint class defined.

Screenshot

One data point, which I'm not sure is relevant: the Pusher.Connections.Net library is dependent upon the WebSocket4Net assembly. If I attempt to add that assembly via the package manager, I get the following error:

Could not install package 'WebSocket4Net 0.8'. You are trying to install this package into a project that targets 'portable-net45+win+wp80+MonoTouch10+MonoAndroid10+xamarinmac20+xamarinios10', 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.

If however, I just go to the site, and download the assembly, and add a reference to it, it seems to satisfy all the WebSocket specific dependencies.

What am I missing? Thanks very much in advance.


Solution

  • The EndPoint class is not part of any PCL profile based on looking at the documentation. At the end of the class information it should say whether it is supported in Portable Class Libraries, which it does for the HttpWebRequest class for example.

    If I create a PCL project in Xamarin Studio and use the assembly browser the System.dll file does not contain any classes but a set of TypeForwardedTo attributes so I am not sure which System.dll you are viewing.

    I suspect that one of your projects or assemblies is using some types which are not available for Portable Class Libraries.