none
Out Parameter position changes after migration from V3.5 to V4.5 RRS feed

  • Question

  • Hi,

    While migrating my code from v3.5 to v4.5, the position of OUT parameters in WCF methods changes its position. Normally it would change in a way that input param comes second and out put parameter comes first.

    When migrated the code, this working changes in a way, the out put parameter comes second and input param comes first.

    Below is the brief explanation of my problem

     

    Framework  : 3.5 

    ISample :  Method A (string param1, out string param2, out string param 3)

    Client : string param 3 methodA(out param 2,param1) 

    Framework  : 4.5 

    ISample :  Method A (string param1, out string param2, out string param 3)

    Client : string param 3 methodA(param1 , out param 2) 

    Kindly help me out.....


    Kartik Sukumaran

    Monday, April 28, 2014 2:24 PM

Answers

  • Hi,

    >>Normally it would change in a way that input param comes second and out put parameter comes first.

    Yes, when in the .Net 3.5 or .Net 4.0, the out put parameter will come first. Because the WSDL does not show the original method signature; instead, it shows the input parameters as a group and the output parameters as another group. When Add Service Reference generates client side proxy, it will download and parse WSDL, then construct a C# method with the specified input and output parameters. Since WSDL does not contain the original method signature, Add Service Reference has its own rule, which happens to be: generate out parameters first, then in parameters.

    For more information, please try to refer to:
    #WCF Out Parameter position change issue:
    http://blog.csdn.net/yyf_ad/article/details/8761187 .

    But this no longer occurs when using .Net 4.5 on the client-side. The parameter order is maintained.

    Best Regards,
    Amy Peng


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, April 29, 2014 5:57 AM
    Moderator

All replies

  • Hi.

    Out parameters must be the last parameters in a method definition.

    Maybe you could try to call method using parameters names :   methodA(param1:valueParam1,out param2:parameter2,  out param3: parameter3);

    Monday, April 28, 2014 3:38 PM
  • Hi,

    >>Normally it would change in a way that input param comes second and out put parameter comes first.

    Yes, when in the .Net 3.5 or .Net 4.0, the out put parameter will come first. Because the WSDL does not show the original method signature; instead, it shows the input parameters as a group and the output parameters as another group. When Add Service Reference generates client side proxy, it will download and parse WSDL, then construct a C# method with the specified input and output parameters. Since WSDL does not contain the original method signature, Add Service Reference has its own rule, which happens to be: generate out parameters first, then in parameters.

    For more information, please try to refer to:
    #WCF Out Parameter position change issue:
    http://blog.csdn.net/yyf_ad/article/details/8761187 .

    But this no longer occurs when using .Net 4.5 on the client-side. The parameter order is maintained.

    Best Regards,
    Amy Peng


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, April 29, 2014 5:57 AM
    Moderator