Skip to content

Commit ed404de

Browse files
authored
[dotnet] Add a 'EnableProfiler' property to enable the 'diagnostics_tracing' component. Fixes #19370. (#22685)
Fixes #19370.
1 parent c8b5d51 commit ed404de

File tree

3 files changed

+22
-1
lines changed

3 files changed

+22
-1
lines changed

docs/building-apps/build-properties.md

+19
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,25 @@ If the .pkg that was created (if `CreatePackage` was enabled) should be signed.
314314

315315
Only applicable to macOS and Mac Catalyst.
316316

317+
## EnableProfiler
318+
319+
Enable components that are required for profiling to work.
320+
321+
It's enabled by default for debug builds (when [MtouchDebug](#MtouchDebug) or
322+
[MmpDebug](#MmpDebug) is enabled), but needs to be enabled manually before
323+
profiling release builds:
324+
325+
```xml
326+
<PropertyGroup>
327+
<EnableProfiler>true</EnableProfiler>
328+
</PropertyGroup>
329+
```
330+
331+
This will increase the app size slightly.
332+
333+
Only applicable when using the Mono runtime (CoreCLR always supports
334+
profiling, while NativeAOT never does).
335+
317336
## EnableSGenConc
318337

319338
Enables the concurrent mode for the SGen garbage collector.

dotnet/targets/Xamarin.Shared.Sdk.targets

+1-1
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@
452452
<ItemGroup>
453453
<_MonoComponent Include="hot_reload" Condition="'$(MtouchInterpreter)' != ''" />
454454
<_MonoComponent Include="debugger" Condition="'$(_BundlerDebug)' == 'true'" />
455-
<_MonoComponent Include="diagnostics_tracing" Condition="'$(_BundlerDebug)' == 'true'" />
455+
<_MonoComponent Include="diagnostics_tracing" Condition="'$(EnableProfiler)' == 'true'" />
456456
<_MonoComponent Include="marshal-ilgen" Condition="'$(_AppleExcludeMarshalIlgenComponent)' != 'true'" />
457457
</ItemGroup>
458458
</Target>

msbuild/Xamarin.Shared/Xamarin.Shared.props

+2
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,8 @@ Copyright (C) 2020 Microsoft. All rights reserved.
292292
<!-- Does not apply unless we're actually building a library - and since BundleOriginalResources can be specified on the command line, use a secondary property -->
293293
<!-- that also encapsulates whether we're a library or not (this makes conditions simpler) -->
294294
<_BundleOriginalResources Condition="'$(OutputType)' == 'Library' And '$(IsAppExtension)' != 'true' And '$(BundleOriginalResources)' == 'true'">true</_BundleOriginalResources>
295+
296+
<EnableProfiling Condition="'$(EnableProfiling)' == '' And '$(_BundlerDebug)' == 'true'">true</EnableProfiling>
295297
</PropertyGroup>
296298

297299
<PropertyGroup Condition="'$(IsBindingProject)' == 'true'">

0 commit comments

Comments
 (0)