mail-archives/mono-bugs/2010-July/101879.html

158 строки
6.2 KiB
HTML
Исходник Постоянная ссылка Обычный вид История

2019-06-06 22:03:35 +03:00
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<TITLE> [Mono-bugs] [Bug 619534] New: Message filter using BeforeSendReply from IDispatchMessageInspector does not work as in Microsoft NET Framework
</TITLE>
<LINK REL="Index" HREF="index.html" >
<LINK REL="made" HREF="mailto:mono-bugs%40lists.ximian.com?Subject=%5BMono-bugs%5D%20%5BBug%20619534%5D%20New%3A%20Message%20filter%20using%20BeforeSendReply%0A%20from%20IDispatchMessageInspector%20does%20not%20work%20as%20in%20Microsoft%20NET%20Framework&In-Reply-To=">
<META NAME="robots" CONTENT="index,nofollow">
<META http-equiv="Content-Type" content="text/html; charset=us-ascii">
<LINK REL="Previous" HREF="101878.html">
<LINK REL="Next" HREF="101886.html">
</HEAD>
<BODY BGCOLOR="#ffffff">
<H1>[Mono-bugs] [Bug 619534] New: Message filter using BeforeSendReply from IDispatchMessageInspector does not work as in Microsoft NET Framework</H1>
<B>bugzilla_noreply at novell.com</B>
<A HREF="mailto:mono-bugs%40lists.ximian.com?Subject=%5BMono-bugs%5D%20%5BBug%20619534%5D%20New%3A%20Message%20filter%20using%20BeforeSendReply%0A%20from%20IDispatchMessageInspector%20does%20not%20work%20as%20in%20Microsoft%20NET%20Framework&In-Reply-To="
TITLE="[Mono-bugs] [Bug 619534] New: Message filter using BeforeSendReply from IDispatchMessageInspector does not work as in Microsoft NET Framework">bugzilla_noreply at novell.com
</A><BR>
<I>Fri Jul 2 08:46:12 EDT 2010</I>
<P><UL>
<LI>Previous message: <A HREF="101878.html">[Mono-bugs] [Bug 477503] DebuggableAttribute emission
</A></li>
<LI>Next message: <A HREF="101886.html">[Mono-bugs] [Bug 619534] Message filter using BeforeSendReply from IDispatchMessageInspector does not work as in Microsoft NET Framework
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#101879">[ date ]</a>
<a href="thread.html#101879">[ thread ]</a>
<a href="subject.html#101879">[ subject ]</a>
<a href="author.html#101879">[ author ]</a>
</LI>
</UL>
<HR>
<!--beginarticle-->
<PRE><A HREF="http://bugzilla.novell.com/show_bug.cgi?id=619534">http://bugzilla.novell.com/show_bug.cgi?id=619534</A>
<A HREF="http://bugzilla.novell.com/show_bug.cgi?id=619534#c0">http://bugzilla.novell.com/show_bug.cgi?id=619534#c0</A>
Summary: Message filter using BeforeSendReply from
IDispatchMessageInspector does not work as in
Microsoft NET Framework
Classification: Mono
Product: Mono: Class Libraries
Version: 2.6.x
Platform: Macintosh
OS/Version: Mac OS X 10.6
Status: NEW
Severity: Major
Priority: P5 - None
Component: WCF
AssignedTo: <A HREF="http://lists.ximian.com/mailman/listinfo/mono-bugs">atsushi at ximian.com</A>
ReportedBy: <A HREF="http://lists.ximian.com/mailman/listinfo/mono-bugs">clovis.ribeiro at myabcm.com</A>
QAContact: <A HREF="http://lists.ximian.com/mailman/listinfo/mono-bugs">mono-bugs at lists.ximian.com</A>
Found By: ---
Blocker: ---
User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_4; en-us)
AppleWebKit/533.16 (KHTML, like Gecko) Version/5.0 Safari/533.16
If you create a message filter using IDispatchMessageInspector interface
implementing BeforeSendReply and decide to completely replace the message
inside, Mono ignores the replaced message.
Example:
If you write a message handler like the one below, the new message added to
reply is ignored.
public void BeforeSendReply(ref System.ServiceModel.Channels.Message reply,
object correlationState)'
{
reply = Message.CreateMessage(reply.Version, reply.Headers.Action,
String.Empty);
}
After looking at Mono sources, file MessageProcessingContext.cs, I realized
there is an error in BeforeSendReply() (line 125) that is not updating the
ReplyMessage after calling the message inspectors. I fixed the code by doing
the following:
public void BeforeSendReply ()
{
Message toBeChanged = request_context.ReplyMessage;
for (int i = 0; i &lt; dispatch_runtime.MessageInspectors.Count; ++i)
dispatch_runtime.MessageInspectors [i].BeforeSendReply (ref
toBeChanged, msg_inspectors_states [i]);
request_context.ReplyMessage = toBeChanged;
}
Note that I only added an extra line to write the toBeChanged back to
request_context.ReplyMessage.
This is exactly what is already being done in AfterReceiveRequest().
My final point here is: although we have not tested yet because we are using
only one message filter, I believe you should add the
request_context.ReplyMessage = toBeChanged inside the for() loop. If you don't
do that, only the last inspector will work correctly. I say that for
BeforeSendReply() AND AfterReceiveRequest().
Hope this helps and feel free to contact me as I have been digging inside this
code for awhile.
Reproducible: Always
Steps to Reproduce:
Create a message inspector by implementing
IDispatchMessageInspector.BeforeSendReply() and completely replace the reply
message inside BeforeSendReply()
Actual Results:
The new message is ignored.
Expected Results:
The new message should be sent back to the client.
--
Configure bugmail: <A HREF="http://bugzilla.novell.com/userprefs.cgi?tab=email">http://bugzilla.novell.com/userprefs.cgi?tab=email</A>
------- You are receiving this mail because: -------
You are the QA contact for the bug.
</PRE>
<!--endarticle-->
<HR>
<P><UL>
<!--threads-->
<LI>Previous message: <A HREF="101878.html">[Mono-bugs] [Bug 477503] DebuggableAttribute emission
</A></li>
<LI>Next message: <A HREF="101886.html">[Mono-bugs] [Bug 619534] Message filter using BeforeSendReply from IDispatchMessageInspector does not work as in Microsoft NET Framework
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#101879">[ date ]</a>
<a href="thread.html#101879">[ thread ]</a>
<a href="subject.html#101879">[ subject ]</a>
<a href="author.html#101879">[ author ]</a>
</LI>
</UL>
<hr>
<a href="http://lists.ximian.com/mailman/listinfo/mono-bugs">More information about the mono-bugs
mailing list</a><br>
</body></html>