Bug 11309 - Incorrect handling of MessageBodyMemberAttribute Order property throws an IndexOutOfRangeException
Summary: Incorrect handling of MessageBodyMemberAttribute Order property throws an Ind...
Status: NEW
Alias: None
Product: Class Libraries
Classification: Mono
Component: WCF assemblies (show other bugs)
Version: 2.10.x
Hardware: PC Linux
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2013-03-20 19:19 UTC by Matt Clay
Modified: 2017-02-06 13:22 UTC (History)
2 users (show)

See Also:
Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
This program throws an IndexOutOfRangeException under Mono, but works properly under Microsoft .NET. (581 bytes, text/plain)
2013-03-20 19:19 UTC, Matt Clay
Details

Description Matt Clay 2013-03-20 19:19:44 UTC
Created attachment 3670 [details]
This program throws an IndexOutOfRangeException under Mono, but works properly under Microsoft .NET.

Mono incorrectly uses the Order value from MessageBodyMemberAttribute when serializing a MessageContract.

Microsoft's .NET uses the Order value as a sorting key when ordering members on a MessageContract, as documented here:

http://msdn.microsoft.com/en-us/library/system.servicemodel.messagebodymemberattribute.order.aspx

Mono, however, appears to limit the value to a 0-based index based on the number of members.  If this limit is exceeded, an exception is thrown:

System.IndexOutOfRangeException: Array index is out of range.
  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.Description.DefaultTypedMessageConverter.ToMessage (System.Object typedMessage, System.ServiceModel.Channels.MessageVersion version) [0x00000] in <filename unknown>:0
  at MessageObjectToPartsException.Program.Main (System.String[] args) [0x00000] in <filename unknown>:0

This may be related to bug #2588, which shows a similar stack trace.  Unfortunately that bug provides no further details.

Note You need to log in before you can comment on or make changes to this bug.