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 ()
Version: 2.10.x
Hardware: PC Linux
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2013-03-20 19:19 UTC by Matt Clay
Modified: 2017-02-06 13:22 UTC (History)
2 users (show)

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

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

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report for Bug 11309 on GitHub or Developer Community if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: GitHub Markdown or Developer Community HTML
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:

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:


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.