Bug 696784

Summary: Call a wcf method with a ref DataContract as parameter, eg: ref Customer makes the parameter null after the call
Product: [Mono] Mono: Class Libraries Reporter: A vR <65rnov>
Component: WCFAssignee: Atsushi Enomoto <atsushieno>
Status: NEW --- QA Contact: Mono Bugs <mono-bugs>
Severity: Major    
Priority: P5 - None    
Version: 2.10.x   
Target Milestone: ---   
Hardware: 32bit   
OS: openSUSE 11.3   
Whiteboard:
Found By: --- Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---
Attachments: WCF service and Winform Application that can reproduce the problem

Description A vR 2011-05-28 07:13:11 UTC
Created attachment 431973 [details]
WCF service and Winform Application that can reproduce the problem

User-Agent:       Mozilla/5.0 (Windows NT 6.1; rv:2.0.1) Gecko/20100101 Firefox/4.0.1

Creating a simple wcf service with a method like 

public class CustomerService : ICustomerService
    {
        public void AddUpdateCustomer(ref Customer customer)
        {
            customer.Id = 1;            
        }

        public void AddUpdateCustomer2(Customer customer)
        {
            customer.Id = 1;
        }
    }

Calling the first method from a winform application, AddUpdateCustomer(ref Customer customer), causes the parameter to be null after the call

CustomerService.Customer customer  = new TestMonoWCFApplication.CustomerService.Customer();
customer.Firstname = "John";
customer.Surname = "Doe";

CustomerService.CustomerServiceClient c = new TestMonoWCFApplication.CustomerService.CustomerServiceClient("BasicHttpBinding_ICustomerService");
c.AddUpdateCustomer(ref customer);

After this call the customer object is null, it should not be null

Reproducible: Always

Steps to Reproduce:
1. Create a simple wcf service, with a Ref parameter in the method
2. Add this service's service reference to a simple winform application
3. Call the method in 1, and after the method the parameter is null
Actual Results:  
A Ref Parameter is always null after a WCF service call.
c.AddUpdateCustomer(ref customer);
Trying to use customer object is useless, as it is null 


Expected Results:  
The customer object above should not be null, and contain the values that were set in the service. (Like customer.Id)

This error, makes the wcf library included with mono 2.10.2, not useful, as this error was not present in mono 2.10.1.