[Mono-dev] ServiceModel Array Index Out of range

dkline dkline at resdat.com
Wed Dec 14 14:57:04 EST 2011


I have a small c# client application that works on windows, but not in mono.
It's general purpose it to copy a file from the client to the host.

I installed mono 10.5 on a Windows 7 box and Ubuntu 10.04 LTS.

I was unable to compile my application with mono in windows, or in ubuntu
because I get the following error:

The type or namespace name `ServiceModel' does not exist in the namespace
`System'. Are you missing an assembly reference?

I also tried running the compiled application in mono, the application
starts but fails with the following error after calling the DataUpload
method:

Error:  Array index is out of range.
Error:
Error:    at (wrapper stelemref) object:virt_stelemref_object
(intptr,object)
  at
System.ServiceModel.Dispatcher.BaseMessagesFormatter.MessageObjectToParts
(System.ServiceModel.Description.MessageDescription md, System.Object
msgObject, System.Collections.Generic.Dictionary`2 headers, System.Object[]
parts) [0x00000] in <filename unknown>:0
  at System.ServiceModel.Dispatcher.BaseMessagesFormatter.SerializeRequest
(System.ServiceModel.Channels.MessageVersion version, System.Object[]
parameters) [0x00000] in <filename unknown>:0
  at System.ServiceModel.Dispatcher.OperationFormatter.SerializeRequest
(System.ServiceModel.Channels.MessageVersion messageVersion, System.Object[]
parameters) [0x00000] in <filename unknown>:0
  at System.ServiceModel.MonoInternal.ClientRuntimeChannel.CreateRequest
(System.ServiceModel.Dispatcher.ClientOperation op, System.Object[]
parameters) [0x00000] in <filename unknown>:0
  at System.ServiceModel.MonoInternal.ClientRuntimeChannel.Request
(System.ServiceModel.Description.OperationDescription od, System.Object[]
parameters) [0x00000] in <filename unknown>:0
  at System.ServiceModel.MonoInternal.ClientRuntimeChannel.DoProcess
(System.Reflection.MethodBase method, System.String operationName,
System.Object[] parameters) [0x00000] in <filename unknown>:0
  at System.ServiceModel.MonoInternal.ClientRuntimeChannel.Process
(System.Reflection.MethodBase method, System.String operationName,
System.Object[] parameters) [0x00000] in <filename unknown>:0

Here is my app.config just in case it is useful:
<configuration>
    <system.serviceModel>
        <client>
            <endpoint address="aValidAddress"
                      binding="basicHttpBinding"
bindingConfiguration="SensorData"
                      contract="SensorData_Contract"/>
        </client>
        <bindings>
            <basicHttpBinding>
                <binding name="SensorData" sendTimeout="00:10:00"
                         messageEncoding="Mtom"
transferMode="StreamedRequest" />
            </basicHttpBinding>
        </bindings>
    </system.serviceModel>
</configuration>

Contract setup:
    [MessageContract]
    public class SendFileRequestMessage
    {
        [MessageHeader(MustUnderstand = true)]
        public FileTransferInfo info;

        [MessageBodyMember(Order = 1)]
        public Stream FileData;
    }

    [ServiceContract]
    public interface ISensorData
    {
        [OperationContract]
        void DataUpload(SendFileRequestMessage request);
    }

    [DataContract]
    public class FileTransferInfo
    {
        [DataMember(Order = 1, IsRequired = true)]
        public string Name { get; set; }

        [DataMember(Order = 2, IsRequired = true)]
        public byte[] Checksum { get; set; }

        [DataMember(Order = 3, IsRequired = true)]
        public byte[] Key { get; set; }
    }

Any help/pointers would be appreciated.

--
View this message in context: http://mono.1490590.n4.nabble.com/ServiceModel-Array-Index-Out-of-range-tp4196752p4196752.html
Sent from the Mono - Dev mailing list archive at Nabble.com.


More information about the Mono-devel-list mailing list