Bug 11480 - System.ServiceModel.Channels.Message duplicated body.
Summary: System.ServiceModel.Channels.Message duplicated body.
Status: NEW
Alias: None
Product: Class Libraries
Classification: Mono
Component: WCF assemblies (show other bugs)
Version: master
Hardware: PC Linux
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2013-03-29 17:56 UTC by Šarūnas Gliebus
Modified: 2014-03-07 09:39 UTC (History)
2 users (show)

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

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 11480 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:
Status:
NEW

Description Šarūnas Gliebus 2013-03-29 17:56:05 UTC
In function WriteBodyContents (XmlDictionaryWriter writer) //In file "mcs/class/System.ServiceModel/System.ServiceModel.Channels/Message.cs",  line ~164

First 'copied_message' variable body is written, latter message body itself is written again. That results in duplicated message body content.

Current code:
	if (copied_message != null)
		copied_message.WriteBodyContents (writer);
	OnWriteBodyContents (writer);

I think i should be replaced into:
	if (copied_message != null)
		copied_message.WriteBodyContents (writer);
	else
		OnWriteBodyContents (writer);

Otherwise reply message body gets duplicated.
Tested on mono versions 3.0.6, mono 2.11.4 and 2.10.8.
On mono version 2.10.8 I could not reproduce this problem. 

Tested with self-hosted wcf service.

Request example:
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
	<s:Header>
		<Security s:mustUnderstand="1" xmlns="http://softdent.lt/apap/security/">
			<ClientCredentials>
				<Username>some_usr</Username>
				<Password>secure_pwd</Password>
			</ClientCredentials>
		</Security>
	</s:Header>
	<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
		<GetVersion xmlns="http://softdent.lt/apap"/>
	</s:Body>
</s:Envelope>


Response example:
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
   <s:Body>
      <GetVersionResponse xmlns="http://softdent.lt/apap">
         <GetVersionResult>apap-proxy-service-Softdent.Communication.Service.Host (1.0.0.0)</GetVersionResult>
      </GetVersionResponse>
      <GetVersionResponse xmlns="http://softdent.lt/apap">
         <GetVersionResult>apap-proxy-service-Softdent.Communication.Service.Host (1.0.0.0)</GetVersionResult>
      </GetVersionResponse>
   </s:Body>
</s:Envelope>

Patch mentioned above fixes the problem, however I'm not sure if doesn't break something else :)