Bug 17448 - ServiceStack PCL DLL not being packaged
Summary: ServiceStack PCL DLL not being packaged
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: General ()
Version: 1.10.x
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: Doug G
Depends on:
Reported: 2014-01-27 16:23 UTC by Doug G
Modified: 2016-12-22 17:42 UTC (History)
7 users (show)

Is this bug a regression?: ---
Last known good build:

ZIP containing example applications and logs (3.12 MB, application/x-zip-compressed)
2014-01-27 16:26 UTC, Doug G

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and 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 Links.

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.

Related Links:

Description Doug G 2014-01-27 16:23:23 UTC
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.
Comment 1 Doug G 2014-01-27 16:26:33 UTC
Created attachment 5923 [details]
ZIP containing example applications and logs
Comment 2 Doug G 2014-01-27 16:28:40 UTC
I can't attached the ServiceStack source (too large when ZIPed) so here are the links:
    - https://github.com/ServiceStack/ServiceStack
    - https://github.com/ServiceStack/ServiceStack.Text
Comment 3 Jose Gallardo 2016-12-22 17:42:23 UTC
Hi Doug, 
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.