wcf icon indicating copy to clipboard operation
wcf copied to clipboard

CallbackDebugBehavior and ChannelDispatcher.IncludeExceptionDetailInFaults are missing

Open Danielku15 opened this issue 4 years ago • 1 comments

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

  1. Try to activate the CallbackDebugBehavior on a duplex client channel and notice that it is missing:
var factory = new DuplexChannelFactory<IMyContract>(...);
factory.Endpoint.EndpointBehaviors.Add(new CallbackDebugBehavior(true));
  1. Try to make an own implementation of CallbackDebugBehavior which sets the IncludeExceptionDetailInFaults based 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.DispatchRuntime only exposes MessageInspectors but no ChannelDispatcher anymore.
  • (.net framework vs .net core)
  • ChannelDispatcher is 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

Danielku15 avatar Jan 17 '22 10:01 Danielku15

@imcarolwang could you please work on a fix for this and submit the PR?

HongGit avatar May 19 '22 20:05 HongGit