Skip to content
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

Backport #51237 to release/6.0-preview4 #51672

Merged
merged 2 commits into from
Apr 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,9 @@
<Uri>https://github.com/dotnet/runtime</Uri>
<Sha>355eff52bed00e7ca9d4a6d769ddbe2bbadbea47</Sha>
</Dependency>
<Dependency Name="Microsoft.NET.ILLink.Tasks" Version="6.0.100-preview.2.21215.2">
<Dependency Name="Microsoft.NET.ILLink.Tasks" Version="6.0.100-preview.2.21217.1">
<Uri>https://github.com/mono/linker</Uri>
<Sha>1ed6f39a6e716b42fa5e478dcfd30a59f1c8f25e</Sha>
<Sha>0e2e95e9db92cd41f620f96dda84171cbf34fa6c</Sha>
</Dependency>
<Dependency Name="Microsoft.DotNet.XHarness.TestRunners.Xunit" Version="1.0.0-prerelease.21214.1">
<Uri>https://github.com/dotnet/xharness</Uri>
Expand Down
2 changes: 1 addition & 1 deletion eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@
<!-- Docs -->
<MicrosoftPrivateIntellisenseVersion>5.0.0-preview-20201009.2</MicrosoftPrivateIntellisenseVersion>
<!-- ILLink -->
<MicrosoftNETILLinkTasksVersion>6.0.100-preview.2.21215.2</MicrosoftNETILLinkTasksVersion>
<MicrosoftNETILLinkTasksVersion>6.0.100-preview.2.21217.1</MicrosoftNETILLinkTasksVersion>
<!-- ICU -->
<MicrosoftNETCoreRuntimeICUTransportVersion>6.0.0-preview.4.21212.2</MicrosoftNETCoreRuntimeICUTransportVersion>
<!-- Mono LLVM -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ public enum EventOpcode
Send = 9,
Receive = 240,
}
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.All)]
public partial class EventSource : System.IDisposable
{
protected EventSource() { }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,6 @@
<property name="Scope">member</property>
<property name="Target">M:Internal.Runtime.InteropServices.ComponentActivator.InternalGetFunctionPointer(System.Runtime.Loader.AssemblyLoadContext,System.String,System.String,System.IntPtr)</property>
</attribute>
<attribute fullname="System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute">
<argument>ILLink</argument>
<argument>IL2072</argument>
<property name="Scope">member</property>
<property name="Target">M:System.Diagnostics.Tracing.EventSource.EnsureDescriptorsInitialized</property>
</attribute>
<attribute fullname="System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute">
<argument>ILLink</argument>
<argument>IL2075</argument>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,11 @@ internal sealed class EventSourceAutoGenerateAttribute : Attribute
/// }
/// </code>
/// </remarks>
#if !ES_BUILD_STANDALONE
// The EnsureDescriptorsInitialized() method might need to access EventSource and its derived type
// members and the trimmer ensures that these members are preserved.
[DynamicallyAccessedMembers(ManifestMemberTypes)]
#endif
public partial class EventSource : IDisposable
{

Expand Down Expand Up @@ -2765,7 +2770,16 @@ private void EnsureDescriptorsInitialized()
{
// get the metadata via reflection.
Debug.Assert(m_rawManifest == null);
#if !ES_BUILD_STANDALONE
[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode",
Justification = "Based on the annotation on EventSource class, Trimmer will see from its analysis members " +
"that are marked with RequiresUnreferencedCode and will warn." +
"This method will not access any of these members and is safe to call.")]
byte[]? GetCreateManifestAndDescriptorsViaLocalMethod(string name) => CreateManifestAndDescriptors(this.GetType(), name, this);
m_rawManifest = GetCreateManifestAndDescriptorsViaLocalMethod(Name);
#else
m_rawManifest = CreateManifestAndDescriptors(this.GetType(), Name, this);
#endif
Debug.Assert(m_eventData != null);

// TODO Enforce singleton pattern
Expand Down