dotnet / dotnet/wcf

EndpointDispatcher and ClientRuntime

Open
#4,706 2 comments 1 reaction 1 assignee Claimed by @mconnew View on GitHub
priority 2 triaged
Dominant language
C#
Stars
1.8k
Forks
576
Avg merge
6d 9h
Merged PRs (30d)
2

Description

Is there any alternative to accessing the `ClientRuntime` from `EndpointDispatcher`?

It seems that in .NET 5.0, using System.ServiceModel 4.8.1, `EndpointDispatcher` class is completely empty, only contains a single empty constructor.

We used to have some tests that would check that an `IEndpointBehavior` was properly added to the client using WCF.

```
var myEndpointBehavior = new MyEndpointBehavior();
var serviceEndpoint = new ServiceEndpoint(new ContractDescription("localhost"));
var dispatcher = new EndpointDispatcher(new EndpointAddress("http://localhost"), "", ""); // <--- Error because EndpointDispatcher class is totally empty
var clientRuntime = dispatcher.DispatchRuntime.CallbackClientRuntime; // <---- does not exist

clientRuntime.ClientMessageInspectors.Should().HaveCount(0);
myEndpointBehavior.ApplyClientBehavior(serviceEndpoint, clientRuntime);
clientRuntime.ClientMessageInspectors.Should().HaveCount(1);
clientRuntime.ClientMessageInspectors.First().Should().BeOfType();
```

Is there any way to test this same behavior in .NET 5.0?

I have been trying to find a way to access the `ClientRuntime` but haven't really found anything

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.