-
-
Notifications
You must be signed in to change notification settings - Fork 393
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
[4.0.0-pre5] Application size increase caused by SocketsHttpHandler support #772
Comments
Precision: I'm using the |
Thank you for reporting this, I agree that's less than ideal and hopefully it's fixable. I'm not very familiar with Maui or the trimming system but I wonder if adding IsTrimmable to Flurl's project file is all that's necessary? I'm willing to do a new prerelease if you're confident that that's all it'll take, but if you're not sure, I think I'd rather walk you through setting up a simple dummy library locally, have you do some testing until we figure out what works, then I'll take what we learn into a new prerelease. (What I want to avoid is iteratively pushing out prereleases in an effort to debug this. Doesn't seem very efficient. 😉) Thoughts? |
I don't think so. When the
I agree. |
Here is a simple repro. I've investigated a bit more the code. I think the issue might be caused by combination of several things. First, even if we provide a client, the code for the clientless pattern is in the path. Flurl/src/Flurl.Http/FlurlRequest.cs Line 141 in 8dbd2b9
Second, the
|
Thanks for investigating. I'm open to changing the APIs around this ahead of the final release - I now realize simple platform sniffing isn't sufficient to know whether SocketsHttpHandler can or should be used. I have ideas for making it more opt-in, and hopefully in the process I'll be able to get it out of the code path that's preventing the trimming in your case. As a side note, can I ask why you're providing your own HttpClient? For 4.0 I'm attempting to minimize the cases where that's needed so I like to have an understanding of cases where it's useful. |
We have:
We get an HttpClient via DI, and then we create a FlurlClient using this HttpClient. |
Cool, those all sound like things 4.0 will have first-class support for (see #770). What you're doing will continue to work so there might not be a compelling reason to change it, but new projects should find those sorts of things easier to do in 4.0. Thanks for sharing! |
Do you think this is enough to solve the original trimmer issue? If so, I can publish a new prerelease. If you're not sure, I would request that you clone or download the repo ( |
@tmenier |
Excellent news! thank you so much for your help with this. I try not to over-use the "help-wanted" label but it's definitely nice to lean on folks in cases where I'd need a significant change to my local dev environment (MAUI in this case). Thanks again! |
I've tested pre6 on my app, the issue I was intially reporting is now gone. One more word. |
Thanks for the kind words. It's users like you who not only report issues (which is always better than nothing!), but also actively help figure out a solution, that makes this project so great to work on. (Reopening until the final release, which might be an unusual flow but fits how I have my project board organized.) |
I'm using Flurl.Http in a dotnet maui application.
When updating Flurl.Http from 4.0.0-pre4 to 4.0.0-pre5, the app size increases by more than 800kB (which is a concern).
Here is the breakdown per assembly (only top increment, before compression):
As you can see, two new assemblies are packed in my app (
System.Net.Sockets.dll
andSystem.Threading.Channels.dll
).However the app is not using the
SocketsHttpHandler
. So the dotnet trimmer should have gotten rid of it.Unless it's somehow always used in Flurl, in some static or init code, that is called by my app, even if the functionality is not used.
Any idea?
The text was updated successfully, but these errors were encountered: