Xamarin.IOS and ServiceStack Dependency Issue

I am running into a dependency issue with ServiceStack in a blank Xamarin.IOS project.
Starting with a Blank Xamarin IOS project I run install-package ServiceStack.Client, and it adds the references to the project. I add a single line of code to the Application.Main function:
IosPclExport.Configure();

Then build the project and get the following dependency errors:
C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(494,3): warning : The dependency ‘System.IO.Compression, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089’ of the assembly ‘ServiceStack.Client, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null’ was not found. Please review the project’s references.
C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(494,3): warning : Could not compute a complete dependency map for the project. This will result in slower build times because Xamarin.iOS can’t properly detect what needs to be rebuilt (and what does not need to be rebuilt). Please review previous warnings for more details.
C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(494,3): warning : The dependency ‘System.IO.Compression, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089’ of the assembly ‘ServiceStack.Client, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null’ was not found. Please review the project’s references.
C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(494,3): warning : Could not compute a complete dependency map for the project. This will result in slower build times because Xamarin.iOS can’t properly detect what needs to be rebuilt (and what does not need to be rebuilt). Please review previous warnings for more details.

I am hoping someone has some insight on how to resolve this issue. I have also sent a support request to Xamarin as I am not sure if the issue is on the Xamarin side or the ServiceStack side, if Xamarin resolves the issue I will post the answer here as well but if anyone has a suggestion or idea on how to resolve the issue I would appreciate it.

Thanks
M

Sounds like Xamarin has an issue trying to find a reference to System.IO.Compression.dll, you can try adding an explicit reference to it from:

C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\Xamarin.iOS\v1.0\System.IO.Compression.dll

The issue is not in finding the DLL, but rather finding the version of the DLL that ServiceStack is looking for.

If I add the reference, I simply get an additional warning on build:
C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets(1697,5): warning MSB3277: Found conflicts between different versions of the same dependent assembly that could not be resolved. These reference conflicts are listed in the build log when log verbosity is set to detailed.

I have also tried adding the DLL from the GAC and get the same additional warning. It appears to me that SS is looking for version 4.0.0.0 however the DLL in the GAC and in the Xamarin.IOS reference assemblies folder is 4.0.50524.0, it seems like a version requirement issue rather than a missing dll issue.

Does this offer any other insights into the issue?
Thanks
M

ServiceStack is only looking for the version of System.IO.Compression that’s built into .NET 4 Framework, so I’m assuming it’s an Xamarin compatibility issue - let me know what Xamarin’s support says.

I have received a reply from Xamarin support, their response is as follows:
“Thank you very much for reaching out to us here at Xamarin with this issue. I appreciate you reached out to us as a first place to start and that you understand this might be a ServiceStack issue. From a cursory glance, I am indeed inclined to point you toward reaching out to ServiceStack with regards to the issue at hand. Sorry to pass the buck here, but at the moment, I think they’d know more than us regarding this issue.”

So I am left with two product that are supposed to work together, both claim to support each others infrastructure but it doesn’t currently work.

Where do I go from here?
Thanks
M

Sigh that’s a shame, this error is clearly that it can’t find the System.IO.Compression dependency:

C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(494,3): warning : The dependency 'System.IO.Compression, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' of the assembly 'ServiceStack.Client, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null' was not found. Please review the project's references.

The ServiceStack.Client.dll that makes use of System.IO.Compression is a PCL dll, so we don’t actually have any explicit references to any .NET Framework assemblies, they’re all included as part of the PCL profiles .NET Portable Subset (Profile 7) which is a PCL profile that Xamarin says they support. Previously Xamarin have had problems with missing System.IO.Compression.dll before, so I imagine this area isn’t very well tested.

Unfortunately given ServiceStack.Client.dll is a PCL dll there’s very little opportunity for us to be able to resolve this on our side, about the only thing I can do is remove any references to System.IO.Compression from the PCL builds since it’s not a required feature but at the same time I really dislike making breaking changes like this for anyone who was relying on it.

This just finished deploying and is now available from v4.0.41 available on MyGet.

As clear as the dependency error is, upgrading to 4.0.41 through MyGet, cleaning the solution and rebuilding it and the errors go away.

To be sure I rolled back to 4.0.40 and did a clean and rebuild and got the errors again. I upgraded to 4.0.41, cleaned and rebuilt and no errors, it now builds clean.

Regardless of where the finger should be pointed, 4.0.41 now works with Xamarin.IOS 8.10. Hopefully this post helps someone else along the way.

Thanks
M

p.s. If it wasn’t a coincidence a new build came out today, thank you for the quick turn around.

Right, I expected the build error to go away since System.IO.Compression is no longer being used/referenced, so the build no longer needs to find the dependency. But this is a less than ideal solution given the compression classes are now no longer available.

Ok, so what does this mean moving forward? Is IO.Compression going to be a dependency in the future and break this all over again?

I can tell you that in “C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\Xamarin.iOS\v1.0” where the IOS framework lives, there is a System.IO.Compression.dll that matches the current .Net System.IO.Compression.dll version.

Now I am far from an expert and I am new to PCL and Xamarin but I don’t believe the System.IO.Compression.dll is a PCL library, so how can ServiceStack.Client as a PCL library in Xamarin.IOS have a dependency that is not a PCL library and doesn’t have a platform specific version? All the discussions online I found about using System.IO.Compress in a PCL suggests using a different compression library as it is not PCL.

I’m simply looking for the solution that is going to get me moving forward in stable fashion and not have this issue crop back up in a week or a month.

Thanks
M

I’m excluding it going forward, but as it’s a breaking change I might be forced to include it in future if there are others relying on it and need it. BTW this issue with System.IO.Compression seems intermittent as it’s not happening for me, so it must be something different in your environment. I’ve excluded it for now to resolve your issue on our side but as mentioned earlier I believe this really is an Xamarin issue (since it’s implicitly referenced within the PCL build where it was used) and so I hope they resolve it in future. This is just the only thing I can think to do on our side to resolve it without Xamarin fixing it on their end. (Only possible since System.IO.Compression isn’t critical functionality).

Now I am far from an expert and I am new to PCL and Xamarin but I don’t believe the System.IO.Compression.dll is a PCL library

System.IO.Compression is apart of the Profile7 PCL Profile otherwise it wouldn’t be available as apart of the .NET Portable Subset for that profile and the ServiceStack.Client.dll PCL library wouldn’t be able to build. The .NET Framework .dll itself doesn’t have to be a PCL .dll to be apart of the portable subset - it just needs to be available in all API’s that are targeted in that profile.

Ok, makes sense, at least I understand the reality of the situation better. I do greatly appreciate your assistance.

I will pass this information on to Xamarin, if there is anything I can do to assist in pushing Xamarin towards a fix please let me know.

For what it is worth, I went so far as uninstalling every Xamarin product on my machine and reinstalling from just their latest stable build to make sure something wasn’t broken in the “upgrading” process from version to version.

I am currently running the following in Visual Studio Professional 2013 Update 4
Xamarin 3.11.445.0 (5061f92)
Xamarin.Android 5.1.0.115 (d23da369e436488f38c8ab8fe8a9ae7d9ea5256b)
Xamarin.iOS 8.10.0.0 (7741cc495ab0baf04ff0405d0604bc27f0ecae2e)

Thanks
M

Just an update on this issue, Xamarin.IOS 8.10.3.2 appears to have resolved the build issues with ServiceStack 4.0.40.0.

Thanks
M

@mythz
Since the SS Client doesn’t have the compression feature build in anymore, can I add it back somehow? Some kind of response filter maybe?

Regards,
Sörnt

@Soernt The change just removes the NetDeflateProvider and NetDeflateProvider classes from the build, you can just copy the source locally to get them back. The PCL Clients are still configured to use Compression where it’s supported.

This MSDN article also shows how to enable compression which you can also do in the new HttpClient-based JsonHttpClient.