Bug 22128 - Linker causes type load exception for WCF call
Summary: Linker causes type load exception for WCF call
Alias: None
Product: iOS
Classification: Xamarin
Component: XI runtime ()
Version: 5.2
Hardware: Macintosh Mac OS
: Normal normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2014-08-15 01:13 UTC by Adam
Modified: 2016-05-25 00:49 UTC (History)
3 users (show)

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

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 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.

Related Links:

Description Adam 2014-08-15 01:13:24 UTC
Recently our application started generating the following error upon receipt of a WCF response:

"Could not load type System.String[] while decoding custom attribute"

And sometimes it is relating to "System.Int32[]" instead...

"Could not load type System.Int32[] while decoding custom attribute"

This error occurs inside of the framework, when the response (a successful one) is returned from the WCF service.

If I turn off linking - all is fine.
Comment 1 Sebastien Pouliot 2014-08-15 09:58:25 UTC
5.2 is likely your version of Xamarin Studio, not Xamarin.iOS (or you're running something that is nearly three years old).

1. Can you provide your exact version information ?

The easiest way to get exact version information is to use the "Xamarin Studio" menu, "About Xamarin Studio" item, "Show Details" button and copy/paste the version informations (you can use the "Copy Information" button).

2. The types Int32[] and String[] are very unlikely the types being removed. My _guess_ is that it's the parent custom attribute that is (partly) removed by the linker (and affect it's decoding).

Is it possible for you to create a small test case ? or to share your application ? so I can duplicate the issue. Such bugs are uncommon but near impossible to track/guess without a test case (e.g. a lot to people use WCF without issues).
Comment 2 Adam 2014-08-16 02:23:00 UTC
Hi Sebastian,

Here is the version info:

Xamarin Studio
Version 5.2.1 (build 1)
Installation UUID: 4908badf-aa1b-4247-90e4-39de694504a8
	Mono 3.6.0 ((no/f540f8a)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 306000039

Version: 4.14.0 (Starter Edition)
Android SDK: /Users/alangley/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		2.1   (API level 7)
		2.2   (API level 8)
		2.3   (API level 10)
		3.1   (API level 12)
		4.0.3 (API level 15)
		4.4   (API level 19)
Java SDK: /usr
java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-462-11M4609)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-462, mixed mode)

Apple Developer Tools
Xcode 5.1.1 (5085)
Build 5B1008


Version: (Business Edition)
Hash: 606f31a
Build date: 2014-08-01 15:27:48-0400

Build Information
Release ID: 502010001
Git revision: d06832ce9807d6be24aca225457e8b37c7669f6f
Build date: 2014-08-07 12:10:47-04
Xamarin addins: 1de032531be4cecf2f39dbee3b87aac78204058c

Operating System
Mac OS X 10.9.4
Darwin adams-mbp 13.3.0 Darwin Kernel Version 13.3.0
    Tue Jun  3 21:27:35 PDT 2014
    root:xnu-2422.110.17~1/RELEASE_X86_64 x86_64

Hmm - test case could be tricky - there is quite a lot of code involved - but I'll see what I can do. I'll try to put together a simple WCF server and app and see if it repro's it. I double I could get clearance to send everything if that fails.

I'll also try forcing the the inclusion of all the attributes that are in the proxy.

 - Adam
Comment 3 Adam 2014-08-16 03:19:07 UTC
Actually, I think the problem goes even deeper.

This has stemmed from the fact that I bought a new Macbook last week, and I'm trying to move my development environment across. This new laptop has the newer OSX as mentioned above.
I cannot even compile to run on the simulator - I get the following error for any dependency which is a ObjC wrapper... and if I remove that dependency, and comment it out - I just get this error for the next native dependency my project has:

error MT5309: Native linking error: warning: ObjC object file (/Users/alangley/Projects/wsamazon/Winscribe/iOS/Author/Code/Mobile.Touch/obj/iPhoneSimulator/Debug/mtouch-cache/libKGStatusBar.a(KGStatusBar.o)) was compiled for iOS Simulator, but linking for MacOSX
error MT5210: Native linking failed, undefined symbol: _NSTextEffectAttributeName. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
error MT5210: Native linking failed, undefined symbol: _NSTextEffectLetterpressStyle. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
error MT5202: Native linking failed. Please review the build log.

I know these are fat binaries which are correctly compiled and linked because the same DLL works just fine on my old laptop.

Hope to get this cleared up soon - I'm flying out to the UK next week and need this machine functioning to take care of the product while I'm away...

adams-mbp:Products alangley$ file libMBProgressHUD.a 
libMBProgressHUD.a: Mach-O universal binary with 5 architectures
libMBProgressHUD.a (for architecture armv7):	current ar archive random library
libMBProgressHUD.a (for architecture armv7s):	current ar archive random library
libMBProgressHUD.a (for architecture i386):	current ar archive random library
libMBProgressHUD.a (for architecture x86_64):	current ar archive random library
libMBProgressHUD.a (for architecture cputype (16777228) cpusubtype (0)):	current ar archive random library
Comment 4 Adam 2014-08-16 03:20:28 UTC
Oh - to clarify - I can compile if I target a physical iPad - no linker errors.
Comment 5 Adam 2014-08-16 03:30:07 UTC
Hmmm... restart of XS and that error went away... biiiizzzaaarrreee

Back to the String[] Int32[] error...
Comment 6 Sebastien Pouliot 2014-08-16 10:38:09 UTC
You can try to isolate which assembly has the attribute byt adding a `-linkskip=assembly` (without a file extension). It can be used as a workaround (less costly than totally disabling the linker).

Also have a full builg log (with `-v -v -v -v) attached to the bug report _might_ help too.
Comment 7 Sebastien Pouliot 2016-05-25 00:49:01 UTC
We have not received the requested information. If you are still experiencing this issue please provide all the requested information and re-open the bug report. Thanks!