Skip to content

Commit

Permalink
Implementation for IDispatchMessageInspector
Browse files Browse the repository at this point in the history
  • Loading branch information
mconnew authored and imcarolwang committed Aug 26, 2021
1 parent aa07a1d commit d45c87e
Show file tree
Hide file tree
Showing 19 changed files with 212 additions and 11 deletions.
40 changes: 40 additions & 0 deletions src/System.Private.ServiceModel/src/Internals/WcfEventSource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,46 @@ public void FaultProviderInvoked(string TypeName, string ExceptionTypeName)
FaultProviderInvoked(TypeName, ExceptionTypeName, "", "");
}

public bool MessageInspectorAfterReceiveInvokedIsEnabled()
{
return base.IsEnabled(EventLevel.Informational, Keywords.Troubleshooting | Keywords.ServiceModel, EventChannel.Analytic);
}

[Event(EventIds.MessageInspectorAfterReceiveInvoked, Level = EventLevel.Informational, Channel = EventChannel.Analytic, Opcode = Opcodes.DispatchMessageDispathMessageInspectorAfterReceiveInvoked, Task = Tasks.DispatchMessage,
Keywords = Keywords.Troubleshooting | Keywords.ServiceModel,
Message = "The Dispatcher invoked 'AfterReceiveReply' on a MessageInspector of type '{0}'.")]
public void MessageInspectorAfterReceiveInvoked(string TypeName, string HostReference, string AppDomain)
{
WriteEvent(EventIds.MessageInspectorAfterReceiveInvoked, TypeName, HostReference, AppDomain);
}

[NonEvent]
public void MessageInspectorAfterReceiveInvoked(EventTraceActivity eventTraceActivity, string TypeName)
{
SetActivityId(eventTraceActivity);
MessageInspectorAfterReceiveInvoked(TypeName, "", "");
}

public bool MessageInspectorBeforeSendInvokedIsEnabled()
{
return base.IsEnabled(EventLevel.Informational, Keywords.Troubleshooting | Keywords.ServiceModel, EventChannel.Analytic);
}

[Event(EventIds.MessageInspectorBeforeSendInvoked, Level = EventLevel.Informational, Channel = EventChannel.Analytic, Opcode = Opcodes.DispatchMessageDispathMessageInspectorBeforeSendInvoked, Task = Tasks.DispatchMessage,
Keywords = Keywords.Troubleshooting | Keywords.ServiceModel,
Message = "The Dispatcher invoked 'BeforeSendRequest' on a MessageInspector of type '{0}'.")]
public void MessageInspectorBeforeSendInvoked(string TypeName, string HostReference, string AppDomain)
{
WriteEvent(EventIds.MessageInspectorBeforeSendInvoked, TypeName, HostReference, AppDomain);
}

[NonEvent]
public void MessageInspectorBeforeSendInvoked(EventTraceActivity eventTraceActivity, string TypeName)
{
SetActivityId(eventTraceActivity);
MessageInspectorBeforeSendInvoked(TypeName, "", "");
}

public bool ParameterInspectorAfterCallInvokedIsEnabled()
{
return base.IsEnabled(EventLevel.Informational, Keywords.Troubleshooting | Keywords.ServiceModel, EventChannel.Analytic);
Expand Down
3 changes: 3 additions & 0 deletions src/System.Private.ServiceModel/src/Resources/Strings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -2994,4 +2994,7 @@
<data name="SFxImmutableClientBaseCacheSetting" xml:space="preserve">
<value>This value cannot be changed after the first ClientBase of type '{0}' has been created.</value>
</data>
<data name="SFxNullReplyFromExtension2" xml:space="preserve">
<value>Extension {0} prevented call to operation '{1}' from replying by setting the reply to null.</value>
</data>
</root>
Original file line number Diff line number Diff line change
Expand Up @@ -3217,6 +3217,11 @@
<target state="translated">Hodnota NONE elementu WS-Addressing není platná pro verzi elementu WS-Addressing ze srpna 2004.</target>
<note />
</trans-unit>
<trans-unit id="SFxNullReplyFromExtension2">
<source>Extension {0} prevented call to operation '{1}' from replying by setting the reply to null.</source>
<target state="new">Extension {0} prevented call to operation '{1}' from replying by setting the reply to null.</target>
<note />
</trans-unit>
<trans-unit id="SFxNullReplyFromFormatter2">
<source>Formatter {0} returned a null reply message for call to operation '{1}'.</source>
<target state="translated">Formátovací modul {0} vrátil zprávu odpovědi s hodnotou NULL pro volání do operace {1}.</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3217,6 +3217,11 @@
<target state="translated">Der Wert "none" der WS-Adressierung ist für die August 2004-Version der WS-Adressierung nicht gültig.</target>
<note />
</trans-unit>
<trans-unit id="SFxNullReplyFromExtension2">
<source>Extension {0} prevented call to operation '{1}' from replying by setting the reply to null.</source>
<target state="new">Extension {0} prevented call to operation '{1}' from replying by setting the reply to null.</target>
<note />
</trans-unit>
<trans-unit id="SFxNullReplyFromFormatter2">
<source>Formatter {0} returned a null reply message for call to operation '{1}'.</source>
<target state="translated">Der Formatierer {0} hat eine leere Antwortnachricht für einen Aufruf des Vorgangs "{1}" zurückgegeben.</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3217,6 +3217,11 @@
<target state="translated">El valor "none" de WS-Addressing no es válido para la versión de agosto de 2004 de WS-Addressing.</target>
<note />
</trans-unit>
<trans-unit id="SFxNullReplyFromExtension2">
<source>Extension {0} prevented call to operation '{1}' from replying by setting the reply to null.</source>
<target state="new">Extension {0} prevented call to operation '{1}' from replying by setting the reply to null.</target>
<note />
</trans-unit>
<trans-unit id="SFxNullReplyFromFormatter2">
<source>Formatter {0} returned a null reply message for call to operation '{1}'.</source>
<target state="translated">El formateador {0} devolvió un mensaje de respuesta nulo para la llamada a la operación "{1}".</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3217,6 +3217,11 @@
<target state="translated">La valeur 'none' de WS-Addressing n'est pas valide pour la version d'août 2004 de WS-Addressing.</target>
<note />
</trans-unit>
<trans-unit id="SFxNullReplyFromExtension2">
<source>Extension {0} prevented call to operation '{1}' from replying by setting the reply to null.</source>
<target state="new">Extension {0} prevented call to operation '{1}' from replying by setting the reply to null.</target>
<note />
</trans-unit>
<trans-unit id="SFxNullReplyFromFormatter2">
<source>Formatter {0} returned a null reply message for call to operation '{1}'.</source>
<target state="translated">Le formateur {0} a retourné un message de réponse avec une valeur null pour l'appel à l'opération '{1}'.</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3217,6 +3217,11 @@
<target state="translated">Valore WS-Addressing "none" non valido per la versione di agosto 2004 di WS-Addressing.</target>
<note />
</trans-unit>
<trans-unit id="SFxNullReplyFromExtension2">
<source>Extension {0} prevented call to operation '{1}' from replying by setting the reply to null.</source>
<target state="new">Extension {0} prevented call to operation '{1}' from replying by setting the reply to null.</target>
<note />
</trans-unit>
<trans-unit id="SFxNullReplyFromFormatter2">
<source>Formatter {0} returned a null reply message for call to operation '{1}'.</source>
<target state="translated">Il formattatore {0} ha restituito un messaggio di risposta Null per la chiamata all'operazione '{1}'.</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3217,6 +3217,11 @@
<target state="translated">WS-Addressing の値を "なし" にすることは、2004 年 8 月版の WS-Addressing では無効です。</target>
<note />
</trans-unit>
<trans-unit id="SFxNullReplyFromExtension2">
<source>Extension {0} prevented call to operation '{1}' from replying by setting the reply to null.</source>
<target state="new">Extension {0} prevented call to operation '{1}' from replying by setting the reply to null.</target>
<note />
</trans-unit>
<trans-unit id="SFxNullReplyFromFormatter2">
<source>Formatter {0} returned a null reply message for call to operation '{1}'.</source>
<target state="translated">フォーマッタ {0} が、操作 '{1}' への呼び出しに対して null の応答メッセージを返しました。</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3217,6 +3217,11 @@
<target state="translated">WS-Addressing "none" 값이 2004년 8월 버전의 WS-Addressing에 올바르지 않습니다.</target>
<note />
</trans-unit>
<trans-unit id="SFxNullReplyFromExtension2">
<source>Extension {0} prevented call to operation '{1}' from replying by setting the reply to null.</source>
<target state="new">Extension {0} prevented call to operation '{1}' from replying by setting the reply to null.</target>
<note />
</trans-unit>
<trans-unit id="SFxNullReplyFromFormatter2">
<source>Formatter {0} returned a null reply message for call to operation '{1}'.</source>
<target state="translated">{0} 포맷터가 '{1}' 작업의 호출에 대해 null 회신 메시지를 반환했습니다.</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3217,6 +3217,11 @@
<target state="translated">Wartość WS-Addressing „none” jest nieprawidłowa dla wersji WS-Addressing z sierpnia 2004.</target>
<note />
</trans-unit>
<trans-unit id="SFxNullReplyFromExtension2">
<source>Extension {0} prevented call to operation '{1}' from replying by setting the reply to null.</source>
<target state="new">Extension {0} prevented call to operation '{1}' from replying by setting the reply to null.</target>
<note />
</trans-unit>
<trans-unit id="SFxNullReplyFromFormatter2">
<source>Formatter {0} returned a null reply message for call to operation '{1}'.</source>
<target state="translated">Program formatujący {0} zwrócił komunikat odpowiedzi o wartości null dla wywołania operacji „{1}”.</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3217,6 +3217,11 @@
<target state="translated">O valor "none" do WS-Addressing não é válido para a versão de agosto de 2004 do WS-Addressing.</target>
<note />
</trans-unit>
<trans-unit id="SFxNullReplyFromExtension2">
<source>Extension {0} prevented call to operation '{1}' from replying by setting the reply to null.</source>
<target state="new">Extension {0} prevented call to operation '{1}' from replying by setting the reply to null.</target>
<note />
</trans-unit>
<trans-unit id="SFxNullReplyFromFormatter2">
<source>Formatter {0} returned a null reply message for call to operation '{1}'.</source>
<target state="translated">O formatador {0} retornou uma mensagem de resposta nula da chamada para a operação '{1}'.</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3217,6 +3217,11 @@
<target state="translated">Значение WS-Addressing "none" недопустимо для версии WS-Addressing августа 2004 г.</target>
<note />
</trans-unit>
<trans-unit id="SFxNullReplyFromExtension2">
<source>Extension {0} prevented call to operation '{1}' from replying by setting the reply to null.</source>
<target state="new">Extension {0} prevented call to operation '{1}' from replying by setting the reply to null.</target>
<note />
</trans-unit>
<trans-unit id="SFxNullReplyFromFormatter2">
<source>Formatter {0} returned a null reply message for call to operation '{1}'.</source>
<target state="translated">Модуль форматирования {0} вернул нулевое ответное сообщение для вызова операции "{1}".</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3217,6 +3217,11 @@
<target state="translated">WS-Addressing "none" değeri, WS-Addressing Ağustos 2004 sürümü için geçerli değil.</target>
<note />
</trans-unit>
<trans-unit id="SFxNullReplyFromExtension2">
<source>Extension {0} prevented call to operation '{1}' from replying by setting the reply to null.</source>
<target state="new">Extension {0} prevented call to operation '{1}' from replying by setting the reply to null.</target>
<note />
</trans-unit>
<trans-unit id="SFxNullReplyFromFormatter2">
<source>Formatter {0} returned a null reply message for call to operation '{1}'.</source>
<target state="translated">{0} biçimlendiricisi '{1}' işlemi çağrısı için bir null yanıt iletisi döndürdü.</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3217,6 +3217,11 @@
<target state="translated">WS-Addressing "none" 值对 2004 年 8 月版本的 WS-Addressing 无效。</target>
<note />
</trans-unit>
<trans-unit id="SFxNullReplyFromExtension2">
<source>Extension {0} prevented call to operation '{1}' from replying by setting the reply to null.</source>
<target state="new">Extension {0} prevented call to operation '{1}' from replying by setting the reply to null.</target>
<note />
</trans-unit>
<trans-unit id="SFxNullReplyFromFormatter2">
<source>Formatter {0} returned a null reply message for call to operation '{1}'.</source>
<target state="translated">格式化程序 {0} 对操作“{1}”的调用返回了空回复消息。</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3217,6 +3217,11 @@
<target state="translated">WS-Addressing "none" 值對於 WS-Addressing August 2004 版本無效。</target>
<note />
</trans-unit>
<trans-unit id="SFxNullReplyFromExtension2">
<source>Extension {0} prevented call to operation '{1}' from replying by setting the reply to null.</source>
<target state="new">Extension {0} prevented call to operation '{1}' from replying by setting the reply to null.</target>
<note />
</trans-unit>
<trans-unit id="SFxNullReplyFromFormatter2">
<source>Formatter {0} returned a null reply message for call to operation '{1}'.</source>
<target state="translated">格式器 {0} 對作業 '{1}' 的呼叫,傳回了 null 的回覆訊息。</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ public sealed class DispatchRuntime
private ChannelDispatcher _channelDispatcher;
private IInstanceProvider _instanceProvider;
private IInstanceContextProvider _instanceContextProvider;
private SynchronizedCollection<IDispatchMessageInspector> _messageInspectors;
private OperationCollection _operations;
private ImmutableDispatchRuntime _runtime;
private SynchronizationContext _synchronizationContext;
private Type _type;
private DispatchOperation _unhandled;
private SharedRuntimeState _shared;
private SynchronizedCollection<IDispatchMessageInspector> _messageInspectors;

internal DispatchRuntime(ClientRuntime proxyRuntime, SharedRuntimeState shared)
: this(shared)
Expand Down Expand Up @@ -159,6 +159,11 @@ public IInstanceProvider InstanceProvider
}
}

public SynchronizedCollection<IDispatchMessageInspector> MessageInspectors
{
get { return _messageInspectors; }
}

public SynchronizedKeyedCollection<string, DispatchOperation> Operations
{
get { return _operations; }
Expand Down Expand Up @@ -190,11 +195,6 @@ public Type Type
}
}

public SynchronizedCollection<IDispatchMessageInspector> MessageInspectors
{
get { return _messageInspectors; }
}

public DispatchOperation UnhandledDispatchOperation
{
get { return _unhandled; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,11 @@ internal bool HandleError(Exception error, ref ErrorHandlerFaultInfo faultInfo)
return HandleErrorCommon(error, ref faultInfo);
}

internal static bool ShouldRethrowExceptionAsIs(Exception e)
{
return true;
}

internal static bool ShouldRethrowClientSideExceptionAsIs(Exception e)
{
return true;
Expand Down
Loading

0 comments on commit d45c87e

Please sign in to comment.