wcf
wcf copied to clipboard
CallbackDebugBehavior and ChannelDispatcher.IncludeExceptionDetailInFaults are missing
Describe the bug
This is a follow up on the extensions which were done already as part of https://github.com/dotnet/wcf/issues/4686. While some aspects were covered there, I am still missing CallbackDebugBehavior and ChannelDispatcher.IncludeExceptionDetailInFaults to properly migrate from .net Framework to .net core.
To Reproduce
- Try to activate the
CallbackDebugBehavioron a duplex client channel and notice that it is missing:
var factory = new DuplexChannelFactory<IMyContract>(...);
factory.Endpoint.EndpointBehaviors.Add(new CallbackDebugBehavior(true));
- Try to make an own implementation of
CallbackDebugBehaviorwhich sets theIncludeExceptionDetailInFaultsbased on some custom logic and notice that quite some classes which were available in .net framework are still missing:
public class CallbackDebugBehavior: IEndpointBehavior
{
public CallbackDebugBehavior(bool includeExceptionDetailInFaults)
{
IncludeExceptionDetailInFaults = includeExceptionDetailInFaults;
}
public bool IncludeExceptionDetailInFaults { get; set; }
void IEndpointBehavior.ApplyClientBehavior(ServiceEndpoint serviceEndpoint, ClientRuntime behavior)
{
var channelDispatcher = behavior.CallbackDispatchRuntime.ChannelDispatcher;
if (channelDispatcher != null && IncludeExceptionDetailInFaults)
{
channelDispatcher.IncludeExceptionDetailInFaults = true;
}
}
// ....
}
-
System.ServiceModel.Dispatcher.DispatchRuntimeonly exposesMessageInspectorsbut noChannelDispatcheranymore. - (.net framework vs .net core)
-
ChannelDispatcheris fully hidden.
Expected behavior
It should be possible to set the IncludeExceptionDetailInFaults on duplex clients both through a built-in CallbackDebugBehavior and also through a custom IEndpointBehavior
Screenshots Not applicable.
Additional context
@imcarolwang could you please work on a fix for this and submit the PR?