Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
Mono organizations on
GitHub to continue tracking issues. Bugzilla will remain
available for reference in read-only mode. We will continue to work
on open Bugzilla bugs, copy them to the new locations
as needed for follow-up, and add the new items under Related
Our sincere thanks to everyone who has contributed on this bug
tracker over the years. Thanks also for your understanding as we
make these adjustments and improvements for the future.
Please create a new report on
Developer Community or GitHub with
your current version information, steps to reproduce, and relevant error
messages or log files if you are hitting an issue that looks similar to
this resolved bug and you do not yet see a matching new report.
Created attachment 6790 [details]
Sample to test ProtoBuf on iOS & Android
Whenever I include Protobuf-net.dll into my iOS project I am getting some compilation error.
Error MT2002: Failed to resolve "System.Void System.ComponentModel.ImmutableObjectAttribute::.ctor(System.Boolean)" reference from "System, Version=18.104.22.168, Culture=neutral, PublicKeyToken=b77a5c561934e089" (MT2002)
But this works fine with Android and executes well.
I am attaching the code with this ticket. Any help is highly appreciable.
"System, Version=22.214.171.124, Culture=neutral, PublicKeyToken=b77a5c561934e089"
^ this is not the version of System.dll that ships with Xamarin.iOS (XI). That version should be 126.96.36.199.
The reason this won't work is because the linker is run (by default) for device builds. That does not happen (at least for DEBUG) on Android devices.
In any case such error would affect the AOT compilation later (Android will fail at JIT time, i.e. at runtime, if the code that uses this is executed).
The fix this properly you need to use a ProtoBuf.dll that is compiled with XI version of System.dll _or_ compiled againt a PCL profile that is compatible with XI.
Created attachment 6791 [details]
When I try to open your project I can see XS (latest version) complaining that two assemblies are not available for the right (XI) framework.
I strongly suggest you to use the PCL version (e.g. using NuGet) of Protobuf . You might also need to do the same for Newtonsoft.Json.
Please readd them as follows:
Protobuff-net.dll from ../ProtoBufTest/SerializerTestLib/SerializerTestLib/bin/Release/protobuf-net.dll
SerializerTestLib from ../ProtoBufTest/SerializerTestLib/SerializerTestLib/bin/Release/SerializerTestLib.dll
For this please compile the SerializerTestLib first to get these dlls.
Hope this helps.
@Mustafa yes I know how to "workaround" the XS warnings.
However that warning is there to tell you it won't work. So while you can workaround it (nad it might work on the JIT/simulator) you'll find yourselve in the situation I described (when trying on devices, AOT).
The fix is to use the PCL versions or rebuild your 2nd project based on the BCL shipped with XI.
That works! I used the one from the following link http://code.google.com/p/protobuf-net/downloads/list, "protobuf-net r668/Full/portable/protobuf-net.dll". This works same for iOS & Android.