-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Resolve ILLink warnings in System.Diagnostics.DiagnosticSource #50265
Conversation
Tagging subscribers to this area: @tommcdon, @krwq Issue DetailsContributes to #45623 There are 2 warnings in System.Diagnostics.DiagnosticSource. This solves the first one - when a Resolving the second warning needs more thinking - maybe introducing a new API, or a new trimmer feature is needed to fix it. See #50130 (comment) for a write up on that warning. The
|
Tagging subscribers to 'linkable-framework': @eerhardt, @vitek-karas, @LakshanF, @tannergooding, @sbomer Issue DetailsContributes to #45623 There are 2 warnings in System.Diagnostics.DiagnosticSource. This solves the first one - when a Resolving the second warning needs more thinking - maybe introducing a new API, or a new trimmer feature is needed to fix it. See #50130 (comment) for a write up on that warning. The
|
...es/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/DiagnosticSourceEventSource.cs
Outdated
Show resolved
Hide resolved
1. Mark DiagnosticSource.Write(string,object) as RequiresUnreferencedCode 2. Suppress the warnings for any .NET libraries that call the DiagnosticSource.Write() API, and annotate the .NET types being passed in to preserve their important properties. - This was done for HttpClient. ASP.NET and EF will need separate changes when those assemblies are made trim compatible 3. Annotate Activity and its small closure of types (ActivityLink, ActivityEvent, ActivityContext, etc) to ensure none of those properties are trimmed. 4. Suppress trim warnings inside DiagnosticSourceEventSource since the public Write method is marked with RequiresUnreferencedCode.
63b5ce9
to
d6ef851
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...es/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/DiagnosticSourceEventSource.cs
Show resolved
Hide resolved
* upstream/main: (568 commits) [wasm] Set __DistroRid on Windows to browser-wasm (dotnet#50842) [wasm] Fix order of include paths, to have the obj dir first (dotnet#50303) [wasm] Fix debug build of AOT cross compiler (dotnet#50418) Fix outdated comment (dotnet#50834) [wasm][tests] Add properties to allow passing args to xharness (dotnet#50678) Vectorized common String.Split() paths (dotnet#38001) Fix binplacing symbol files. (dotnet#50819) Move type check to after the null ref branch in out marshalling of blittable classes. (dotnet#50735) Remove extraneous CMake version requirement. (dotnet#50805) [wasm] Remove unncessary condition for EMSDK (dotnet#50810) Add loop alignment stats to JitLogCsv (dotnet#50624) Resolve ILLink warnings in System.Diagnostics.DiagnosticSource (dotnet#50265) Avoid unnecessary closures/delegates in Process (dotnet#50496) Fix for field layout verification across version bubble boundary (dotnet#50364) JIT: Enable CSE for VectorX.Create (dotnet#50644) [main] Update dependencies from mono/linker (dotnet#50779) [mono] More domain cleanup (dotnet#50771) Race condition in Mock reference tracker runtime with GC. (dotnet#50804) Remove IAssemblyName (and various fusion remnants) (dotnet#50755) Disable failing test for GCStress. (dotnet#50828) ...
Contributes to #45623
Addresses all warnings in
System.Diagnostics.DiagnosticSource
with the following plan:DiagnosticSource.Write(string,object)
asRequiresUnreferencedCode
DiagnosticSource.Write()
API, and annotate the .NET types being passed in to preserve their important properties.DiagnosticSourceEventSource
since the public Write method is marked withRequiresUnreferencedCode
.RequiresUnreferencedCode
since sub-properties can be selected).The
DynamicDependency
attributes onFetcherForProperty
are no longer needed, as the trimmer knows about this Reflection pattern intrinsically and preserves the constructors correctly.