Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Reference newer Nuget Microsoft.Extensions.Caching.Memory breaks Tcp-Server #1373

Open
1 task done
AlleSchonWeg opened this issue Apr 24, 2024 · 6 comments
Open
1 task done
Labels
bug Something isn't working

Comments

@AlleSchonWeg
Copy link

Duplicate ?

  • I have searched issues/discussions and did not find other issues/discussions reporting this bug.

Product version

1.5.2

Describe expected behavior

Hi,
my Server-App uses the Microsoft.Extensions.Caching.Memory nuget for caching. Using the newest version should work.

Describe actual behavior

I referenced Microsoft.Extensions.Caching.Memory version 8.0.0. But with this reference a call from a client never completes. I saw that CoreWCF also used this library and i tried to downgrade my version also to version 2.1.23. Then my clients can successfully call my server. I have not tested all versions above, but with 3.1.1 the calls started to fail.

Which binding

NetTcp

security

None

Which .NET version

.NET Framework

Which os platform

Windows

Code snippet used to reproduce the issue

No response

Stacktrace if any

No response

@AlleSchonWeg AlleSchonWeg added the bug Something isn't working label Apr 24, 2024
@mconnew
Copy link
Member

mconnew commented Apr 24, 2024

You're saying when you promoted the version of Microsoft.Extensions.Caching.Memory to 8.0.0 by adding a reference for your own usage, CoreWCF stopped responding to calls? I just tested changing our unit test projects to reference Microsoft.Extensions.Caching.Memory 8.0.0. I had one small compilation problem where ILoggingBuilder has moved packages and promoting this reference caused the type to be seen in two different packages. The solution was to add a package reference to version 8.0.0 of Microsoft.Extensions.Logging.Abstractions and Microsoft.Extensions.Logging. I checked NetTcp and Http and they are both functioning as expected, so there's something different that you are doing.

Upgrading those packages caused our .NET Framework tests to fail. This is because on .NET Framework, we reference the nuget package Microsoft.AspNetCore to use ASP.NET Core. When running on .NET, your project needs to either use the Sdk Microsoft.NET.Sdk.Web, or include the following to have your app use the .NET runtime built in version of ASP.NET Core.

  <ItemGroup">
    <FrameworkReference Include="Microsoft.AspNetCore.App" />
  </ItemGroup>

If the problem isn't due to not using the right Sdk or missing the <FrameworkReference>, then I'm out of ideas as I can't reproduce it. Have you tried running under a debugger to see if there's any exceptions thrown which are getting swallowed? If that doesn't yield anything useful, can you provide a minimal repro project which has the problem?

@AlleSchonWeg
Copy link
Author

AlleSchonWeg commented Apr 25, 2024

You're saying when you promoted the version of Microsoft.Extensions.Caching.Memory to 8.0.0 by adding a reference for your own usage, CoreWCF stopped responding to calls?

Hi,
yes. This is exactly what happens. I have created a repro. The repro contains a client and a server as console applications. Start both, wait until server is ready then press key in the client app. The client do this:

          var binding = new NetTcpBinding("MyBindingConfig");
          var baseUri = $"net.tcp://localhost:{22203}/";
          var url = baseUri + "dataProvider";
          var address = new EndpointAddress(url);
          var dataProviderFactory = new ChannelFactory<ICommonDataProvider>(binding, address);
          var chan = dataProviderFactory.CreateChannel();
          //CallToServer run in timeout
          var result = chan.CallToServer("Parameter");

In the provider project a have a reference to Microsoft.Extensions.Caching.Memory 8.0.0:

  <ItemGroup>
    <PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="8.0.0" />
    <PackageReference Include="System.ServiceModel.Primitives" Version="4.10.3" />
  </ItemGroup>

Change Microsoft.Extensions.Caching.Memory to version 2.1.23, clean and rebuild solution and try again. Now the call is finished succesfully.
ReproCoreWcf.zip
Thank you.

@AlleSchonWeg
Copy link
Author

Hi @mconnew ,
do yo had any time to try my repro?
I changed <Project Sdk="Microsoft.NET.Sdk"> to <Project Sdk="Microsoft.NET.Sdk.Web"> but it's still not working. Same behavior.
Thank you.

@mconnew
Copy link
Member

mconnew commented May 9, 2024

Haven't had time yet, feel free to keep bugging me as I want to work out what's going on with this.

@AlleSchonWeg
Copy link
Author

Thank you @mconnew ,
I spend a lot of time to find out what is going on. It would be very helpful to have a fix. Perhaps the solution is only a small fix.

@a-shoemaker
Copy link

I have experienced the call never completes, it just times out. But it doesn't seem to match up with the other pieces of your scenario. With an operation contract method that is void with no arguments a call will timeout while every other operation on the service contract works fine. And it's only a subset of all the applications that we have using this contract (i.e., some clients work fine with the same host), but doesn't appear to be related to the version of Microsoft.Extensions.Caching.Memory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants