Bug 21312 - WCF call with "out List<T>" parameter returns null in Mono, but not in Windows Console app.
Summary: WCF call with "out List<T>" parameter returns null in Mono, but not in Window...
Status: NEW
Alias: None
Product: Class Libraries
Classification: Mono
Component: WCF assemblies (show other bugs)
Version: 3.4.0
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2014-07-14 13:59 UTC by Jon Goldberger [MSFT]
Modified: 2014-10-20 16:45 UTC (History)
3 users (show)

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


Attachments
Test Projects (29.48 KB, application/zip)
2014-07-14 13:59 UTC, Jon Goldberger [MSFT]
Details

Comment 1 Jon Goldberger [MSFT] 2014-07-14 14:02:12 UTC
From customer case:

"Today I have encountered a big problem with WCF in Xamarin iOS. The problem is that when a service has a method with an out List<T> parameter, the client running on Xamarin iOS this value will always be null.  I append pieces of code that I hope will be helpful for you.

First of all we have implemented a WCF service. You can find the interface in IAppWCF.cs file and the implementation (although I could not give a complete file) in AppWCF.cs - both files are attached to this email. The interesting method is this one:

MobileResultCode GetFolders(string token, int userId, int folderId, MobileModule module, out List<TMobileFolder> folders, int depth = 1);

The method returns an enum value and also has an out parameter. You can find WSDL for our service in AppWCF_single.wsdl file and I also attached a client generated with slsvcutil - AppWCFClient.cs file. I also added generate_client.bar file where you can find exact command I use to create client.

When I use AppWCFClient in my Xamarin iOS app the value of out List<TMobileFolder> folders is always null. First I create the client:

var timeout = new TimeSpan(0, 0, 30);
var binding = new BasicHttpBinding
{
Name = "AppWCFBasicHttpBinding",
MaxBufferSize = int.MaxValue,
MaxReceivedMessageSize = int.MaxValue,
SendTimeout = timeout,
OpenTimeout = timeout,
ReceiveTimeout = timeout,
};
client = new AppWCFClient(binding, new EndpointAddress("http://192.168.75.253:8093/app"));

and then I use it:

client.GetFoldersCompleted += client_GetFoldersCompleted;
client.GetFoldersAsync(token, userId, folderId, MobileModule.DocumentManagementModule, 1);

and the method called upon completion:

static void client_GetFoldersCompleted(object sender, GetFoldersCompletedEventArgs e)
{
Console.WriteLine(e.folders); // e.folders is always null when AppWCFClient is running on Xamarin iOS
}

And as you can see from the comment e.folders value is always null.

To make sure I am not bothering you for nothing, I checked the same client and the same code in a Windows console app on Windows and it works perfectly - you can see it in Program.cs. I also checked messages exchanged between our service and service client running on Xamarin iOS using Fiddler and they are correct - folders value is there, you can see it in response.txt. To me it looks like mono is not parsing the incoming message correctly."
Comment 2 Jon Goldberger [MSFT] 2014-07-14 14:16:04 UTC
The code noted above is slightly different in the test project provided. 

To reproduce this issue:

1. Unzip test project.
2. Run VS 2013 as an administrator.
3. Open outparamserv.sln from Visual Studio instance opened in step 2.
4. Run project.
5. Open firewall and IIS for remote connections using the IP address of your Windows machine
>a. Open an administrative command prompt
>b. Enter the following two commands, using the IP address of your Windows workstation.
>>netsh http add urlacl url=http://10.0.1.18:9090/ user=everyone
>>netsh http add urlacl url=http://10.0.1.18:9091/ user=everyone
>>netsh advfirewall firewall add rule name="testCase" dir=in protocol=tcp localport=9090 profile=private remoteip=localsubnet action=allow
>>netsh advfirewall firewall add rule name="testCase" dir=in protocol=tcp localport=9091 profile=private remoteip=localsubnet action=allow
6. Launch a new instance of Visual Studio and open outparamclient.sln from the test project folder
7. Run the project.

Expected Result: Console displays "is null false" indicating that the List<T> was returned properly.
Actual Result: as expected.

8. Open outparamclient.sln in Xamarin Studio on a Mac
9. Run the project

Expected result:  Console displays "is null false" indicating that the List<T> was returned properly.
Actual result: "is null true" is displayed.

10. Open "outparamtestios.sln" in Xamarin Studio on a Mac
11. Run the project

Expected result:  Console displays "is null false" indicating that the List<T> was returned properly.
Actual result: "is null true" is displayed.
Comment 3 Jon Goldberger [MSFT] 2014-07-14 14:17:07 UTC
Version info from customer:

=== Xamarin Studio ===

Version 5.1.2 (build 0)
Installation UUID: 503fc1f1-050c-444c-b869-2d15b0f850c1
Runtime:
Mono 3.4.0 ((no/954ed3c)
GTK+ 2.24.23 (Raleigh theme)

Package version: 304000214

=== Xamarin.Android ===

Version: 4.12.6 (Business Edition)
Android SDK: /Users/bc/xamarin-android-sdk
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.8.0_05"
Java(TM) SE Runtime Environment (build 1.8.0_05-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.5-b02, mixed mode)

=== Apple Developer Tools ===

Xcode 5.1.1 (5085)
Build 5B1008

=== Xamarin.Mac ===

Version:

=== Xamarin.iOS ===

Version: 7.2.5.5 (Business Edition)
Hash: 87026b6
Branch:
Build date: 2014-07-02 19:39:08-0400

=== Build Information ===

Release ID: 501020000
Git revision: 4574b1e5cf09f2e95e486c259bd9267a68c77cb3
Build date: 2014-07-02 20:50:40-04
Xamarin addins: fdea6fe3e36cda39291b39c81133e409c6d6f092

=== Operating System ===

Mac OS X 10.9.4
Darwin jarvis 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

Note You need to log in before you can comment on or make changes to this bug.