Note that there are some explanatory texts on larger screens.

plurals
  1. POarray passed as parameter to a WCF service to be filled up comes back full of null's
    text
    copied!<p>I'm trying to write a WCF pipe service. One of my service's methods will receive an <code>object[]</code> as a parameter and fill it up, emulating <code>IDataReader</code>'s <code>GetValues</code> method. But whenever I call this method from my client I get a full of <code>null</code> values array. I also tried changing the <code>object[]</code> parameter to <code>ref object[]</code> but nothing changes.</p> <p>I've been doing some tests after first writing this question and this is weirder than I first though. The hole problem seems to occur in the client's side. Here is some code (all taken from client side):</p> <pre><code>object[] values = new object[reader.FieldCount]; // values is filled up with null's reader.GetValues(values); // values is again filled up with null's (see code bellow) </code></pre> <p>This is <code>GetValues</code>, called by the code above:</p> <pre><code>public int GetValues(object[] values) { // values is filled out with null's, naturally return DatabaseProxy.Instance.GetValues(_ConnectionId, _ReaderId, ref values); // values has content here! (values[0] == "hello this is a string") } </code></pre> <p>The <code>GetValues</code> method in <code>DatabaseProxy.Instance</code> is my server's method, which takes a <code>ref</code> parameter because otherwise it would return an array full of <code>null</code>s. By using the <code>ref</code> modifier, now it does return values, but then these values disappear inside my client. Any idea what's going on here?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload