lundi 3 novembre 2014

How to solve the ref keyword issue in C#(WCF Contracts)?


Vote count:

0




i am having [in,out,size_is(Size)] byte compress_page[*] parameter in my idl file. now we are migrating to wcf.


for ex:


see this function in IDL file



long RMTReadMultiPages([in] File fh,
[in, string] char prj[],
[in] long fileno,
[in] long extno,
[in] long pageStart,
[in,out] long *numPages,
[in] long transferSize,
[out] short *failCode,
[in,out,size_is(Size)] byte compress_page[*]
);


i have to write this function in C#.


My major Problem :


I have tried to host my Wcf service with Entlib 5.0 Validation. When servie operation contracts go for validation they get crash. Whiel investigating, I found that ref keyword in Wcf service's operation giving this problem. E.g.:


Operation contract in service is like:


public void GetData(int ID, string name, ref string location) {};


Now, while validating string location, it gets crash and if I remove ref keyword it works fine.


i tried replacing "ref" with "out" the issue was solved.


But "ref" replacing with "out" means [in, out] was replaced with out.. i am getting some junk values in "compress_page".



can you please help me out?


asked 50 secs ago







How to solve the ref keyword issue in C#(WCF Contracts)?

Aucun commentaire:

Enregistrer un commentaire