Bug 2240 - Wcf out Parameters
Summary: Wcf out Parameters
Status: RESOLVED DUPLICATE of bug 4367
Alias: None
Product: iOS
Classification: Xamarin
Component: XI runtime ()
Version: 5.0
Hardware: Macintosh Mac OS
: --- minor
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2011-11-29 01:43 UTC by James Clancey
Modified: 2014-10-20 16:45 UTC (History)
7 users (show)

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


Attachments
Test solution, including the server side code, as well as one portable class library and Windows + Android + iOs clients (175.54 KB, application/octet-stream)
2013-11-04 16:19 UTC, Lucian POPESCU
Details


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:
Status:
RESOLVED DUPLICATE of bug 4367

Description James Clancey 2011-11-29 01:43:16 UTC
In our application we're getting data from DB via WCF service (SSL; SOAP). The problem we have is with functions that have out parameter - we get error 
"Exception has been thrown by the target of an invocation.; INNER: System.NullReferenceException: Object reference not set to an instance of an object", pointing to lines in proxy file.

This WCF proxy file was created by adding reference to service in Silverlight application and not via slsvcutil tool.

When we call other functions that don't have out parameter everything works. Also, when we remove out parameter from mentioned functions we dont't get errors. 


We tried creating proxy file via svcutil tools, but with no success, so we added reference to service in SIlverlight application. While the service wasn't secured proxy generation via svcutil worked fine, but not anymore. Maybe there's a problem with the certificate.

When using slsvcutil tool on Windows we get following error:



„Attempting to download metadata from 'https://abc.com/Service.svc' using WS-Metadata Exchange or DISCO.



Error: Cannot obtain Metadata from 'https://abc.com/Service.svc'



If this is a Windows (R) Communication Foundation service to which you have access, please check that you have enabled metadata publishing at the specified address.



Metadata contains a reference that cannot be resolved: 'https://abc.com/Service.svc'.



Could not establish trust relationship for the SSL/TLS secure channel with authority 'abc.com'.



The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel. The remote certificate is invalid according to the validation procedure.“.





Now we tried it on Mac and that produces this error:



"Attempting to download metadata from 'https://abc.com/Service.svc' using DISCO..

Disco failed for the url 'https://abc.com/Service.svc' with exception :

Error getting response stream (Write: The authentication or decryption has failed.): SendFailure



Attempting to download metadata from https://abc.com/Service.svc using WS-MetadataExchange..



Unhandled Exception: System.ArgumentException: Argument EndpointAddress has unsupported URI scheme: https

at System.ServiceModel.Channels.HttpChannelFactory`1[System.ServiceModel.Channels.IRequestChannel].OnCreateChannel (System.ServiceModel.EndpointAddress address, System.Uri via) [0x00000] in <filename unknown>:0

at System.ServiceModel.Channels.ChannelFactoryBase`1[System.ServiceModel.Channels.IRequestChannel].CreateChannel (System.ServiceModel.EndpointAddress remoteAddress, System.Uri via) [0x00000] in <filename unknown>:0

at System.ServiceModel.Channels.TransactionChannelFactory`1[System.ServiceModel.Channels.IRequestChannel].OnCreateChannel (System.ServiceModel.EndpointAddress remoteAddress, System.Uri via) [0x00000] in <filename unknown>:0

at System.ServiceModel.Channels.ChannelFactoryBase`1[System.ServiceModel.Channels.IRequestChannel].CreateChannel (System.ServiceModel.EndpointAddress remoteAddress, System.Uri via) [0x00000] in <filename unknown>:0

at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)

at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0

[ERROR] FATAL UNHANDLED EXCEPTION: System.ArgumentException: Argument EndpointAddress has unsupported URI scheme: https

at System.ServiceModel.Channels.HttpChannelFactory`1[System.ServiceModel.Channels.IRequestChannel].OnCreateChannel (System.ServiceModel.EndpointAddress address, System.Uri via) [0x00000] in <filename unknown>:0

at System.ServiceModel.Channels.ChannelFactoryBase`1[System.ServiceModel.Channels.IRequestChannel].CreateChannel (System.ServiceModel.EndpointAddress remoteAddress, System.Uri via) [0x00000] in <filename unknown>:0

at System.ServiceModel.Channels.TransactionChannelFactory`1[System.ServiceModel.Channels.IRequestChannel].OnCreateChannel (System.ServiceModel.EndpointAddress remoteAddress, System.Uri via) [0x00000] in <filename unknown>:0

at System.ServiceModel.Channels.ChannelFactoryBase`1[System.ServiceModel.Channels.IRequestChannel].CreateChannel (System.ServiceModel.EndpointAddress remoteAddress, System.Uri via) [0x00000] in <filename unknown>:0

at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)

at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0 „.
Comment 1 crazypit 2012-02-24 07:58:49 UTC
Can someone confirm that WCF out parameters are NOT currently supported? And i think that Importance of this one, is definitely not "Minor".
Comment 2 Miguel de Icaza [MSFT] 2012-02-24 15:01:25 UTC
The logs on that error do not seem to have any indication about out parameters.

Would it be possible to get your actual client and server solutions for me to test?
Comment 3 crazypit 2012-02-28 02:05:27 UTC
My comment has nothing to do with the aforementioned error. I just posted here because someone in Stack Overflow forum answered to me that WCF Out parameters are not supported and presented THIS link as the entry for the issue.

Do you need me to create a new issue? Can you do that for me? If you still need a test solution i can send one to you but i guess it's not that easy to create one as more and more people say that Out parameters are not supported and this is a known issue.
Comment 4 crazypit 2012-02-28 02:06:50 UTC
If a new issue is created, my opinion is that it definitely has a major importance.
Comment 5 Sebastien Pouliot 2012-04-14 11:22:31 UTC
a new bug, with an attached test case, was submitted for the same 'out' issue

*** This bug has been marked as a duplicate of bug 4367 ***
Comment 6 Lucian POPESCU 2013-11-04 16:19:10 UTC
Created attachment 5328 [details]
Test solution, including the server side code, as well as one portable class library and Windows + Android + iOs clients

Hello, I continue to have issues with out parameters in Wcf services, in the latest versions of Xamarin.

I have attached a sample solution, which includes the sources for: 
1.	a WCF service 
2.	a portable class library, that is referenced by all the projects inside the ‘Clients’ folder
3.	an Android client
4.	an iOs client
5.	a console application
6.	a Windows Phone client
7.	a Windows Store application
8.	a WPF application


Version information (and details on reproducing the bug)

Microsoft Visual Studio Ultimate 2012
Version 11.0.60610.01 Update 3
Microsoft .NET Framework
Version 4.5.51641
Version installée : Ultimate

Outils d'architecture et de modélisation   04940-004-0038003-02231
Outils d'architecture et de modélisation Microsoft    
UML® et Unified Modeling Language™ sont des marques ou des marques déposées de Object Management Group, Inc. aux États-Unis d'Amérique et dans d'autres pays.
Team Explorer pour Visual Studio 2012   04940-004-0038003-02231
Microsoft Team Explorer pour Visual Studio 2012
Vérificateur orthographique d'analyse du code Visual Studio 2012   04940-004-0038003-02231
Vérificateur orthographique d'analyse du code Microsoft® Visual Studio® 2012
Parties de International CorrectSpell™ spelling correction system © 1993 de Lernout & Hauspie Speech Products N.V. Tous droits réservés.
The American Heritage® Dictionary of the English Language, troisième édition Copyright © 1992 Houghton Mifflin Company. Version électronique sous licence Lernout & Hauspie Speech Products N.V. Tous droits réservés.
Visual Basic 2012   04940-004-0038003-02231
Microsoft Visual Basic 2012
Visual C++ 2012   04940-004-0038003-02231
Microsoft Visual C++ 2012
Visual C# 2012   04940-004-0038003-02231
Microsoft Visual C# 2012
Visual F# 2012   04940-004-0038003-02231
Microsoft Visual F# 2012

Windows Phone SDK 8.0 - FRA   04940-004-0038003-02231
Windows Phone SDK 8.0 - FRA

AlignAssignments   1.0
Command for aligning assignments.
CustomDocWell   1.0
Provides configurable behavior for the document well in Visual Studio 2012.

Entity Framework Power Tools   1.0
Adds useful design-time DbContext features to the Visual Studio Solution Explorer context menu. 

When right-clicking on a file containing a derived DbContext class, the following context menu functions are supported:

1) View Entity Data Model - Displays the underlying Code First model in the Entity Framework designer.
2) View Entity Data Model XML - Displays the EDMX XML representing the underlying Code First model.
3) Generate Views - Generates pre-compiled views used by the EF runtime to improve start-up performance. Adds the generated views file to the containing project.

Gestionnaire de package NuGet   2.7.40911.225
Gestionnaire de packages NuGet dans Visual Studio. Pour plus d’informations sur NuGet, consultez http://docs.nuget.org/.

Microsoft Advertising SDK for Windows Phone   
Microsoft Advertising SDK for Windows Phone
Build 

Microsoft XNA Game Studio   4.0
Microsoft XNA Game Studio 4.0
Build 4.0.40906.0

Mobile.Design   1.0
Information about my package

OptionsPageImpl   1.0
Information about my package

PowerCommands for Visual Studio 2010   1.0
A set of power commands for Visual Studio 2010

PreEmptive Analytics Visualizer   1.0
Extension Microsoft Visual Studio permettant de visualiser des résumés agrégés à partir du produit PreEmptive Analytics.

Quick Launch Tasks   1.0
Microsoft Quick LaunchTasks package adds accessibility and settings tasks to the Quick Launch tool.

VSColorOutput   1.4.5
Color output for build and debug windows - http://blueonionsoftware.com/vscoloroutput.aspx

Web Developer Tools   1.2.40308.0
Microsoft Web Developer Tools contient les composants suivants :
Inspecteur de page : outil offrant une manière efficace de décomposer les applications web et de diagnostiquer les problèmes frontaux.
Publication Web : extensions requises pour la publication sur le web, pour les serveurs hébergés et sur site.
Modèles de formulaires web : inclut les modèles par défaut pour les applications de formulaire web.
Extensions Éditeur : inclut les extensions éditeur HTML, CSS et JS qui améliorent considérablement l’expérience de développement.

Workflow Manager Tools 1.0   1.0
Ce package contient les composants d’intégration Visual Studio nécessaires pour Workflow Manager.

Xamarin.Android   4.8.03015 (a25a31d0)
Visual Studio plugin to enable development for Xamarin.Android.

Xamarin.iOS   1.4.2 (7e177260)
Visual Studio extension to enable development for Xamarin.iOS

VMDebugger
For more information about VMware, Inc., see their website at
http://www.vmware.com
Copyright (c) 2012 VMware, Inc.

Steps to reproduce the bug : 
The portable class library has four methods, each of these methods calling the corresponding method in the WCF service. 
Each client references the portable class library and, when calling the method in the portable library, they write to the Visual Studio output window the name of the method and the output values. 

There are test cases for WCF methods with :
a.	void return type and one out parameter, 
b.	int return type and one out parameter,
c.	void return type and two out parameters,
d.	int return type and two out parameters

You will see that, for the Windows-platform clients, the outputs are not null, while on Android and iOs, all the outputs are null.
If you’re asking why I added methods with two out parameters, more details here: http://stackoverflow.com/questions/3827155/wcf-and-out-parameters. 
Basically, I wanted to test this behaviour with Mono/Xamarin. Using methods with two out parameters on Windows clients raises no issue.

Thank you for your time and, please, do not hesitate if you need additional information.