etienne_marais
Honorary Master
I have a C# Windows Forms application [client] which consumes a C# webservice. The Windows Forms application's reference to the webservice is configured for Collection Type as System.Collections.Generic.List as the webservice returns structures containing lists and also has methods with parameters of type List<T>.
Today I added two methods to the webservice, I updated the service reference in the client and some 90 odd errors popped up. I commented out the two methods in the webservice and ran the service update again, same problem.
All the errors are related to List<T> versus T[] (array of Type)
Just to check, I reconfigured the service reference's collection type to Array and even ArrayList, and then back to List again. No go.
Here is an example:
In the webservice is defined:
In the client I have:
which used to work fine until that service reference update.
The compile error is on the second line:
" Cannot convert List to [] "
To fix this:
but that requires a value for n which is not known before runtime.
What the hell happened ?
Funny enough, this coincided with a Windows 10 update(s), don't know if it is related or not.
Today I added two methods to the webservice, I updated the service reference in the client and some 90 odd errors popped up. I commented out the two methods in the webservice and ran the service update again, same problem.
All the errors are related to List<T> versus T[] (array of Type)
Just to check, I reconfigured the service reference's collection type to Array and even ArrayList, and then back to List again. No go.
Here is an example:
In the webservice is defined:
Code:
public class ParameterSet
{
public List<Parameter> Parameters = new List<Parameter>();
}
In the client I have:
Code:
MyWebServiceReference.ParameterSet parameterSet = new MyWebServiceReference.ParameterSet();
parameterSet.Parameters = new List<MyWebServiceReference.Parameter>();
which used to work fine until that service reference update.
The compile error is on the second line:
" Cannot convert List to [] "
To fix this:
Code:
parameterSet.Parameters = new MyWebService.Parameter[n];
but that requires a value for n which is not known before runtime.
What the hell happened ?
Funny enough, this coincided with a Windows 10 update(s), don't know if it is related or not.
Last edited:
