Commit Graph
19 Commits
Author SHA1 Message Date
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 SayedandEric Erhardt 04dac7b0fe Allow restricting cultures creation with any arbitrary names in Globalization Invariant Mode (#54247)
Co-authored-by: Eric Erhardt <[email protected]>
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 FernandoandVitek Karas 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 <[email protected]>

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

Co-authored-by: Vitek Karas <[email protected]>

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

Co-authored-by: Vitek Karas <[email protected]>

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

Co-authored-by: Vitek Karas <[email protected]>

* fixing the native host feature settings

* feedback on error code

* fb

* FB

* merge conflict

Co-authored-by: Vitek Karas <[email protected]>
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 FernandoandElinor Fung 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 <[email protected]>

Co-authored-by: Elinor Fung <[email protected]>
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 GovindarajanandEric Erhardt 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 <[email protected]>
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
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 <[email protected]>

* Add UnreferencedCode attribute

* Apply suggestions from code review

Co-authored-by: Vitek Karas <[email protected]>

* Update message

* Update baseline

Co-authored-by: Jan Kotas <[email protected]>
Co-authored-by: Vitek Karas <[email protected]>
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