Skip to content

Set HttpActivityPropagationSupport=true for non-Release builds #9933

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

Merged
merged 2 commits into from
Mar 20, 2025

Conversation

jfversluis
Copy link
Member

Fixes #9932

Copy link
Contributor

@dellis1972 dellis1972 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just wish there was a better way to detect release builds. So many users do not use the standard Debug / Release configurations :(

@jonpryor
Copy link
Contributor

@dellis1972 remarked:

I just wish there was a better way to detect release builds. So many users do not use the standard Debug / Release configurations :(

which is something I also mentioned in passing elsewhere.

Should we be using '$(Configuration)' == 'Release'? Or should we do what we've done elsewhere, '$(DebugSymbols)' == 'True'? Or '$(Optimize)' == 'True'?

…or just tie it to fast deployment (lol?)?

I think I largely agree with the sentiment that we should continue to avoid '$(Configuration)' == 'Release' whenever possible. The problem is largely deciding on what should be used instead.

@jonpryor
Copy link
Contributor

To explicitly add: my current preference is to use '$(Optimize)' == 'True' for "Release" configuration builds. I'd like @dellis1972 to chime in.

@jonpryor
Copy link
Contributor

Draft commit message:

[Xamarin.Android.Build.Tasks] $(HttpActivityPropagationSupport)=false in "Release" (#9928)

Context: d22f04ea8edbcfa90f16257e60295667b0887414
Context: https://github.com/dotnet/aspire/issues/4684
Context: https://github.com/dotnet/maui/pull/24365
Context: https://github.com/jfversluis/MauiAspire

Commit d22f04ea set the default value of the
[`$(HttpActivityPropagationSupport)' MSBuild property][0] to false,
which "removes code related to diagnostics support for
System.Net.Http."  This was done to reduce app size.

.NET Aspire also uses System.Net.Http, and we'd like to System.Net.Http
diagnostics support to be available by default in that environment;
see also dotnet/aspire#4684 and dotnet/maui#24365.

Update the `$(HttpActivityPropagationSupport)` MSBuild property to be
false by default only in "Release" configuration builds.

[0]: https://learn.microsoft.com/en-us/dotnet/core/deploying/trimming/trimming-options

@dellis1972
Copy link
Contributor

To explicitly add: my current preference is to use '$(Optimize)' == 'True' for "Release" configuration builds. I'd like @dellis1972 to chime in.

using Optimize might be a better way to go here.

@rolfbjarne
Copy link
Member

I just wish there was a better way to detect release builds. So many users do not use the standard Debug / Release configurations :(

There's this: dotnet/sdk#31918... it's been almost two years since it was filed.

IMHO at this point we (the android/macios/maui teams) could just decide to do something, and hope the SDK follows suit at some point.

@jonpryor jonpryor merged commit ba63153 into main Mar 20, 2025
55 of 58 checks passed
@jonpryor jonpryor deleted the dev/fix-9932 branch March 20, 2025 18:06
@jfversluis
Copy link
Member Author

@dellis1972 @jonpryor just for my understanding, what does Optimize mean?

@dellis1972
Copy link
Contributor

@dellis1972 @jonpryor just for my understanding, what does Optimize mean?

Is a standard MSBuild property for the C# compiler which optimizes the IL.

A boolean value that when set to true, enables compiler optimizations. This property is equivalent to the /optimize compiler switch.

See https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/compiler-options/code-generation#optimize

rolfbjarne pushed a commit to dotnet/macios that referenced this pull request Mar 25, 2025
#22430)

We set `HttpActivityPropagationSupport=false` when `Optimize=true`, to match what Android does (dotnet/android#9933).

Fixes #22429.

---------

Co-authored-by: Gerald Versluis <gerald.versluis@microsoft.com>
@github-actions github-actions bot locked and limited conversation to collaborators Apr 20, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Set HttpActivityPropagationSupport=true for non-Release builds
4 participants