1
0
Fork 0
mirror of https://github.com/VSadov/Satori.git synced 2025-06-08 03:27:04 +09:00
Commit graph

34 commits

Author SHA1 Message Date
Lakshan Fernando
432c4a0941
Add 4 new feature switches that are not going to be publicly documented (#105496) 2024-07-26 09:54:39 -07:00
Lakshan Fernando
cc96c132b1
Update feature switch doc to remove duplication of official docs (#104673)
* Sort the current table by the build properties

* Document WinForms feature switches

* FB
2024-07-22 10:40:18 -04:00
Eirik Tsarpalis
a95e71806d
Remove NullabilityInfoContext.IsSupported feature switch (#103970)
* Remove NullabilityInfoContext.IsSupported feature switch

* Remove trimming tests
2024-06-26 12:43:21 +01:00
Lakshan Fernando
715e6971c4
Removing RUC from Default and Ambient attributes (#100821)
* Removing RUC from Default and Ambient attributes

* FB

* FB2
2024-04-13 10:11:42 -07:00
Sven Boemer
4a01602049
Disable COM descriptor support when trimming (#100881)
Defaults the COM type descriptor feature switch to false in trimmed apps.
Depends on the SDK change https://github.com/dotnet/sdk/pull/40106.
2024-04-10 14:33:44 -07:00
Tarek Mahmoud Sayed
3aeefbdd5e
Metrics Feature Switch (#91767) 2023-09-12 16:09:48 -07:00
Jonathan Peppers
fecf3eeffd
[DependencyInjection] introduce feature switch to disable S.R.E (#91133)
When recording a new AOT profile for .NET MAUI apps running on Android,
we noticed that System.Reflection.Emit work was being done on a
background thread. The call seen in `dotnet-trace` output:

    11.32ms microsoft.extensions.dependencyinjection!Microsoft.Extensions.DependencyInjection.ServiceLookup.ILEmitResolverBuilder.GenerateMethodBody(Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceCallSite,System.Reflection.Emit.ILGenerator)

.NET Android apps are unique in that there is a JIT,
`RuntimeFeature.IsDynamicCodeCompiled` is true, System.Reflection.Emit
is possible -- S.R.E is however, not great for startup performance.

Starting threads on Android during startup can also be slow, as Android
will commonly put all but a single core to sleep for battery saving
purposes. We try to avoid starting threads on startup for "hello world"
applications on Android.

To solve this for now, introduce a new feature flag:

    Microsoft.Extensions.DependencyInjection.DisableDynamicEngine

Which, we will provide a value in either the Android or .NET MAUI
optional workload via an MSBuild property. To test, I put this in my
app's `.csproj` file:

    <RuntimeHostConfigurationOption Include="Microsoft.Extensions.DependencyInjection.DisableDynamicEngine"
                                    Condition="'$(DisableDynamicEngine)' != ''"
                                    Value="$(DisableDynamicEngine)"
                                    Trim="true" />

Customers *could* opt to change this flag, but we don't think it will
particularly useful. An example of services realized by .NET MAUI at
startup, via some logging added:

    08-25 13:21:55.647 16530 16530 I DOTNET  : RealizeService called: System.Collections.Generic.IEnumerable`1[Microsoft.Maui.Hosting.IMauiInitializeService]
    08-25 13:21:55.664 16530 16530 I DOTNET  : RealizeService called: System.Collections.Generic.IEnumerable`1[Microsoft.Maui.Hosting.IMauiInitializeScopedService]
    08-25 13:21:55.665 16530 16530 I DOTNET  : RealizeService called: Microsoft.Maui.Dispatching.IDispatcher
    08-25 13:21:55.668 16530 16530 I DOTNET  : RealizeService called: System.Collections.Generic.IEnumerable`1[Microsoft.Maui.LifecycleEvents.LifecycleEventRegistration]
    08-25 13:21:56.057 16530 16530 I DOTNET  : RealizeService called: System.Collections.Generic.IEnumerable`1[Microsoft.Maui.Hosting.HandlerMauiAppBuilderExtensions+HandlerRegistration]
    08-25 13:21:56.115 16530 16530 I DOTNET  : RealizeService called: Microsoft.Extensions.DependencyInjection.IServiceScopeFactory
    08-25 13:21:56.670 16530 16530 I DOTNET  : RealizeService called: Microsoft.Maui.Controls.HideSoftInputOnTappedChangedManager
    08-25 13:21:56.712 16530 16530 I DOTNET  : RealizeService called: System.Collections.Generic.IEnumerable`1[Microsoft.Maui.Hosting.ImageSourcesMauiAppBuilderExtensions+ImageSourceRegistration]
    08-25 13:21:57.700 16530 16530 I DOTNET  : RealizeService using S.R.E: Microsoft.Maui.Controls.HideSoftInputOnTappedChangedManager

`HideSoftInputOnTappedChangedManager` would be realized once per page,
which would not be a huge payoff to use S.R.E for. So the only way the
S.R.E codepath could be useful on Android would be if the customer is
registering lots of services themselves. They might be better off just
using `new()` in that case?

An example of the startup time Android reports with the new flag on/off:

    DisableDynamicEngine=false
    08-25 14:31:37.462  2090  2330 I ActivityTaskManager: Displayed com.companyname.testmaui/crc643c09abdeec717b83.MainActivity: +733ms
    08-25 14:31:39.394  2090  2330 I ActivityTaskManager: Displayed com.companyname.testmaui/crc643c09abdeec717b83.MainActivity: +737ms
    08-25 14:31:41.326  2090  2330 I ActivityTaskManager: Displayed com.companyname.testmaui/crc643c09abdeec717b83.MainActivity: +730ms
    DisableDynamicEngine=true
    08-25 14:32:20.233  2090  2330 I ActivityTaskManager: Displayed com.companyname.testmaui/crc643c09abdeec717b83.MainActivity: +724ms
    08-25 14:32:22.137  2090  2330 I ActivityTaskManager: Displayed com.companyname.testmaui/crc643c09abdeec717b83.MainActivity: +727ms
    08-25 14:32:24.042  2090  2330 I ActivityTaskManager: Displayed com.companyname.testmaui/crc643c09abdeec717b83.MainActivity: +716ms

This was a `dotnet new maui` project, using dotnet/maui/main on a Pixel
5 device.

Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com>
2023-08-30 14:44:05 -05:00
Filip Navara
cf3328ccee
Fix UseManagedNtlm linker substitutions (#90957)
* Fix UseManagedNtlm linker Substitutions

- Specify the default value (false) for the feature on Linux so the linker runs the substitution when no value was specified by the user.
- Make the `UseManagedNtlm` property public because the linker and IL compiler doesn't support substitution of private properties.
- Add `--ignore-substitutions` switch to ILLink during library build to prevent the substitution with default value taking place.

* Revert unnecessary changes, document _UseManagedNtlm switch

* Set _UseManagedNtlm in NativeAOT integration

* Revert unnecessary change, move default values for trimming properties from NativeAOT targets to ILLink ones

* Fix build
2023-08-29 09:36:45 -07:00
Jeremy Koritzinsky
4a8a0eea8b
Fix the default behavior to trim the RCW interop by default (#89128) 2023-07-19 15:59:34 -07:00
Ilona Tomkowicz
6022b3e0c3
[browser][non-icu] HybridGlobalization indexing (#85254)
* A bit faster version of indexing. WIP

* Tiny speedup.

* Fixed IndexOf, ToDo: LastIndexOf.

* All tests pass.

* Updated docs.

* Update docs.

* Slicing + saving previous absolute index instead of pushing the iterator to the start position.

* Refactored.

* Fixed tests on browser.

* Str1 and str2 was confusing.

* Fix CI- correctly trimming Hybrid properties.

* Previous commit should target only Browser.

* Applied @mkhamoyan's suggestion to avoid code duplication.

* Applied @pavelsavara's review.

* Get rid of build errors.

* Revert.
2023-05-18 14:39:34 +02:00
Eirik Tsarpalis
0f11212710
Implement the JsonSerializer.IsReflectionEnabledByDefault feature switch (#83844)
* Implement the STJ.DisableDefaultReflection feature switch.

* Reinstate accidentally stripped attribute

* Address feedback.

* Address feedback.

* Add a trimming test for STJ

* Move trimming test to existing trimming tests folder.

* Add source gen serialization test case to Trimming test.

* Fix style.

* Expose the feature switch as a property on JsonSerializer -- rename feature switch to match namespace.

* Update src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonSerializer.Helpers.cs

Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com>

* Update src/libraries/System.Text.Json/tests/System.Text.Json.Tests/TrimmingTests/IsReflectionEnabledByDefaultFalse.cs

Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com>

* Address feedback.

* Address feedback.

* Add entry to feature-switches.md

---------

Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com>
2023-04-05 21:21:06 +01:00
Meri Khamoyan
7e8f4383ae
Remove HybridGlobalization info from linker feature switches (#84073) 2023-03-29 15:50:05 +02:00
Meri Khamoyan
f561a058b1
Initial changes for GetLocaleInfoString (#81470)
Initial changes for globalization hybrid mode.
Implemented GetLocaleInfoStringName and GetLocaleNameNative for osx platforms.
2023-03-28 12:13:28 +04:00
Tlakaelel Axayakatl Ceja
657f6654e5
Change github illink links (#80407)
Change github illink links to point from dotnet/linker to dotnet/runtime
Delete scripts that clone illink into runtime since illink now lives in runtime
Create a forward link for error 1012 in illink, that leads users to open an issue in runtime
2023-01-11 11:59:14 -08:00
Eric Erhardt
7c212d2f0d
Update Libraries Feature Switches for DynamicCodeSupport (#80397) 2023-01-09 18:29:19 -08:00
Eric Erhardt
65f04b9f29
Resolve MakeGenericType ILLink warning in DependencyInjection (#55102)
* Resolve MakeGenericType ILLink warning in DependencyInjection

Resolve the ILLink warning in DependencyInjection by adding a runtime check that is behind a new AppContext switch 'Microsoft.Extensions.DependencyInjection.VerifyOpenGenericServiceTrimmability'. The runtime check ensures the trimming annotations on the open generic types are compatible between the service and implementation types. The check is enabled by default when PublishTrimmed=true.

* Make VerifyOpenGenericServiceTrimmability a full feature switch
2021-07-31 08:46:27 -06:00
Eric Erhardt
577d079a72
Move ILLink.LinkAttributes to shared and support NullabilityInfoContext with trimming nullability attributes (#56475)
* Copy ILLink.LinkAttributes from mono to shared.

* Update ILLink.LinkAttributes that are now shared between mono and coreclr

- Move IntrinsicAttribute to mono only
- Introduce feature switches for NullabilityInfoContext and AggressiveAttributeTrimming
- Minor other cleanup

* Respect the NullabilityInfoContext.IsSupported feature switch in NullabilityInfoContext.

* Document new feature switches

* Add trimming tests for NullabilityInfoContextSupport

* Move NonVersionableAttribute to mono-only

* Fix Linq tests now that the ExtensionAttribute isn't being trimmed all the time on mono WASM
2021-07-30 14:07:01 -05:00
Tarek Mahmoud Sayed
04dac7b0fe
Allow restricting cultures creation with any arbitrary names in Globalization Invariant Mode (#54247)
Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com>
2021-07-01 11:55:05 -07:00
Mike McLaughlin
cef40a107f
Move the metadata update related APIs to the MetadataUpdater class (#54590)
Move the metadata update related APIs to the MetadataUpdater class

The old APIs AssemblyExtensions.ApplyUpdate() and AssemblyExtensions.GetApplyUpdateCapabilities() will be removed
after all the references to them have been changed to the new APIs.

Add the new IsSupported API described in issue https://github.com/dotnet/runtime/issues/51159.

Change the tests to use the MetadataUpdater APIs.

Fix the ApplyUpdate qcalls and icalls

Add the ILLink substitutions for MetadataUpdater.IsSupported property

Change the old APIs to call the new ones

Update mono's MetadataUpdater.IsSupported property

Update feature switch doc

Fixed the argument checking in coreclr's MetadataUpdater.ApplyUpdate().
2021-06-24 22:54:28 -07:00
Aaron Robinson
bf008ec1ce
Update feature-switches.md (#53639) 2021-06-03 19:47:07 -07:00
Lakshan Fernando
6854225c09
Com trimming related work (#52940)
* COM related work and native host name changes

* FB
2021-05-21 06:12:46 -07:00
Lakshan Fernando
127be4b389
Native host warnings fix (#52109)
* Native host warnings fix

Native host warnings fix

* Feedback

* Update docs/design/features/IJW-activation.md

Co-authored-by: Vitek Karas <vitek.karas@microsoft.com>

* Update src/coreclr/System.Private.CoreLib/src/ILLink/ILLink.Descriptors.xml

Co-authored-by: Vitek Karas <vitek.karas@microsoft.com>

* Update src/coreclr/System.Private.CoreLib/src/ILLink/ILLink.Descriptors.xml

Co-authored-by: Vitek Karas <vitek.karas@microsoft.com>

* Update docs/workflow/trimming/feature-switches.md

Co-authored-by: Vitek Karas <vitek.karas@microsoft.com>

* fixing the native host feature settings

* feedback on error code

* fb

* FB

* merge conflict

Co-authored-by: Vitek Karas <vitek.karas@microsoft.com>
2021-05-15 13:26:10 -07:00
Aaron Robinson
60735c6d3f
NSAutoreleasePool instance should be added to all threads. (#52023)
Add an NSAutoreleasePool to all managed create threads including the Main and Finalizer.

This expands the current support where support was only added to ThreadPool threads. 

New feature switch was created and the ThreadPool one was removed.
 - System.Threading.Thread.EnableAutoreleasePool

Updated AutoReleaseTest for the new scenarios.
2021-05-10 13:31:39 -07:00
Lakshan Fernando
9d46a821f2
Fixes COM warnings (#52176)
* Fixes COm warnings

* fb

* feedback

* missed one name change

* Update docs/workflow/trimming/feature-switches.md

Co-authored-by: Elinor Fung <elfung@microsoft.com>

Co-authored-by: Elinor Fung <elfung@microsoft.com>
2021-05-07 07:39:16 -07:00
Alexander Köplinger
94e14014a0
Fix feature switches doc about UseNativeHttpHandler (#52055)
The value actually checked in the sdk is UseNativeHttpHandler, not HttpNativeHandler.
2021-04-29 17:50:30 +02:00
Prashanth Govindarajan
3c135c5c38
Prohibit BF unless the app opts in (#48527)
* Prohibit BF unless the app opts in

* Address feedback

* First unit test

* 2nd unit test. Checkpoint

* sq

* sq

* sq

* Address Levi's feedback

* sq

* Address nits

* Linker changes and tests

* sq

* sq

* Linker warnings ids

* Address comments

* Change trimming test so linker can detect a pattern

* sq

* Address comments

* sq

Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com>
2021-03-31 13:08:23 -07:00
Eric Erhardt
99f4062f8e
Add documentation on ILLink files (#50302)
* Add documentation on ILLink files

* Add link to ILLink-files from project-guidelines
2021-03-28 16:52:37 -05:00
Egor Bogatov
8df235a28f
Android / iOS / tvOS specific HttpClientHandler (#47083)
Implements #46646 and #47083 (comment)

Per https://github.com/dotnet/designs/blob/main/accepted/2020/mono-convergence/platform-specific-httpclient.md , the default HttpClientHandler will be the native handler specific to Android, iOS, and tvOS.

To fall back to SocketsHttpHandler, simply set the System.Net.Http.UseNativeHttpHandler AppContext switch.

AppContext.SetSwitch("System.Net.Http.UseNativeHttpHandler", true);
2021-03-02 13:26:18 -05:00
Jeremy Koritzinsky
86eacff9d9
Threadpool autorelease (#47592) 2021-02-23 17:19:16 -08:00
Jose Perez Rodriguez
744f1ffe55
Resolve ILLink warnings for System.Resources.ResourceManager (#47778)
* Making System.Resources.ResourceManager trim safe

* Addressing PR Feedback

* Rename objects => types

* Also rename the strings.resx

* More PR Feedback

* Add UnconditionalSuppressMessage to Extensions

* Rename feature switch and reword error messages

* Removing new warning that is already addressed

* Rename AppContext switch and add feature switch to docs

* Addressing Feedback

* Revert changes to findtype plus some other feedback

* Revert FindType back

* move feature check up
2021-02-08 20:44:48 +00:00
Mateo Torres-Ruiz
fdf1494334
Add feature switch for disabling startup hooks (#44050)
* Introduce feature switch for startup hook

* Add test

* Update md

* Update src/coreclr/src/System.Private.CoreLib/src/System/StartupHookProvider.cs

Co-authored-by: Jan Kotas <jkotas@microsoft.com>

* Add UnreferencedCode attribute

* Apply suggestions from code review

Co-authored-by: Vitek Karas <vitek.karas@microsoft.com>

* Update message

* Update baseline

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
Co-authored-by: Vitek Karas <vitek.karas@microsoft.com>
2020-11-13 13:04:25 -08:00
Eric Erhardt
632cdcab09
Trim more Http DiagnosticsHandler code (#39525)
Since the DiagnosticsHandler still gets instantiated in the HttpClientHandler, none of its overriden methods are getting trimmed. This leads to System.Diagnostics.DiagnosticListener still being preserved in a linked application.

The fix is to split DiagnosticsHandler.IsEnabled() into two methods:

* IsGloballyEnabled() - checks the AppContext switch, and is replaced by the linker by a feature swtich.
* IsEnabled() - which checks IsGloballyEnabled() and if there is an Activity or listener available.

This allows all but the IsEnabled and IsGloballyEnabled methods to get trimmed on DiagnosticsHandler.

Contributes to #38765
2020-07-21 08:59:52 -05:00
Levi Broderick
0554117cd7
Introduce BinaryFormatter enablement switch; disable on wasm (#38963)
Applications are given the option of disabling BinaryFormatter.Serialize and BinaryFormatter.Deserialize, meaning they'll throw NotSupportedException if anybody tries calling them. WASM projects always disable these APIs via a hardcoded mechanism; there is no re-enablement mechanism for those projects.

This commit only introduces the switch. It does not disable it in any project types by default. (Exception: wasm, as mentioned above.) The related PR https://github.com/dotnet/sdk/pull/12434 causes aspnet 5.0+ applications to disable BinaryFormatter functionality by default, but apps can re-enable if needed.
2020-07-15 22:26:32 -07:00
Marek Safar
48cd478981
Add documentation about libraries features switches (#39200)
* Add documentation about libraries features switches

* Review feedback

* Casing tweaks
2020-07-13 15:58:49 -05:00