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 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.
I'm trying to port one of my iOS apps from the Mono versions of the ServiceStack libraries to the PCL versions for JSON serialization/deserialization. I have the libraries working in a regular Windows console application. When trying to port this into the iOS application, I'm getting an "Object reference not set to an instance of an object" exception from on the ServiceStack extension method classes. The error message is a red herring; the true error is getting swollowed by a try/catch. The static constructor in ServiceStack.Text.PCL.PclExport is doing late binding for a platform specific DLL and can't find that DLL. The build log bears out that the Client, Interface, and Pcl libraries aren't being packaged with the .app file even though the reference are included at the project level.
I've been able to reproduce this in a basic iOS Hello World application. If I add a line of code that references a method in the Pcl DLL, the three missing libraries are copied. However, I'm still getting the same "Object reference not set to an instance of an object" error. I'm not sure if this is a problem with late binding and Xamarin in general, how the .app file is created, or specific to SerivceStack.
Attached in the ZIP is a bunch of stuff:
1) Two code examples:
a) "ServiceStackPclConsole" - a Windows console application that serializes and deserializes a basic object;
b) "ServiceStackPclTest" - an iOS Hello World application that only serializes that same basic object;
2) two build logs with exception messages:
a) "iOS build log without line 37.txt" - shows the initial error I received;
b) "iOS build log with line 37.txt" - shows the error I receive after included a direct reference to an object in the ServiceStack.Pcl.iOS DLL that forces the Client, Interface, and Pcl libraries to be included; and
3) the source code from github for both SerivceStack and ServiceStack.Text libraries in case you want to build your own DLLs for some deep dive debugging of the libraries.
Created attachment 5923 [details]
ZIP containing example applications and logs
I can't attached the ServiceStack source (too large when ZIPed) so here are the links:
Not sure why this bug has been marked as NEED_INFO, as no info was requested.
Given how old the report is and given that we don't have any other similar reports, I'll move it to Resolved / Fixed, but please feel free to reopen the issue if you can still reproduce it with current bits.