[BUG][csharp-netcore] C# Client for Net Core generate port exaustion
Created by: lucamazzanti
Description
I moved from Net Framework 4.7 to Net Core 3.1 and 5 and I have a critical issue.
The csharp-netcore client uses RestSharp and is not stable with Net Core actually. See this issue. It seems to be a net core breaking change they won't patch in time and actually this is impacting on RestSharp.
It silently open at every call a new socket, creating a new HttpWebRequest each time. This is a behavior totally different in NetFramework where it keep the same. You can reproduce it easily generating a simple client and using it in both verisons. Test multiple calls and watch the connection in Wireshark, I can further add images or a report if you prefer.
While NetFramework honors the keep-alive header (supported also by the server) in Net Core it doesnt.
- In NetFramework it do the handshake and TLS connection just 1 time, and it consumes just one socket keeping working on it with the next calls.
- In Net Core not, it open a new socket each times.
This is critical because you cannot understand it when moving your client to net core until you have a feedback from the server closing the connections to all.
I see there is a version with HttpClient, i tried it but it create every time:
var handler = new HttpClientHandler(); var client = new HttpClient();
openapi-generator version
openapi-generator-cli-5.1.0.jar with csharp-netcore client without settings.