Skip to content

Commit

Permalink
Build fix
Browse files Browse the repository at this point in the history
  • Loading branch information
thompson-tomo committed Feb 13, 2024
1 parent 073f84c commit 7c1c137
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
Expand Up @@ -31,6 +31,7 @@

using System;
using System.Collections.Concurrent;
using System.Diagnostics.CodeAnalysis;
using System.Diagnostics.Tracing;
using System.Timers;

Expand Down
Expand Up @@ -30,12 +30,13 @@
//---------------------------------------------------------------------------

using System;
using System.Diagnostics.CodeAnalysis;
using System.Diagnostics.Tracing;

namespace RabbitMQ.Client.Logging
{
[EventSource(Name = "rabbitmq-dotnet-client")]
public sealed class RabbitMqClientEventSource : EventSource
internal sealed partial class RabbitMqClientEventSource : EventSource
{
public class Keywords
{
Expand All @@ -46,7 +47,7 @@ public RabbitMqClientEventSource() : base(EventSourceSettings.EtwSelfDescribingE
{
}

public static RabbitMqClientEventSource Log = new RabbitMqClientEventSource();
public static readonly RabbitMqClientEventSource Log = new RabbitMqClientEventSource();

[Event(1, Message = "INFO", Keywords = Keywords.Log, Level = EventLevel.Informational)]
public void Info(string message)
Expand All @@ -70,11 +71,6 @@ public void Error(string message, RabbitMqExceptionDetail ex)
#if NET6_0_OR_GREATER
WriteExceptionEvent(message, ex);

[UnconditionalSuppressMessage("Trimming", "IL2026", Justification = "The properties are preserved with the DynamicallyAccessedMembers attribute.")]
void WriteExceptionEvent<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties)] T>(string message, T ex)
{
WriteEvent(3, message, ex);
}
#else
WriteEvent(3, message, ex);
#endif
Expand All @@ -86,5 +82,13 @@ public void Error(string message, Exception ex)
{
Error(message, new RabbitMqExceptionDetail(ex));
}

#if NET6_0_OR_GREATER
[UnconditionalSuppressMessage("Trimming", "IL2026", Justification = "The properties are preserved with the DynamicallyAccessedMembers attribute.")]
private void WriteExceptionEvent<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties)] T>(string message, T ex)
{
WriteEvent(3, message, ex);
}
#endif
}
}

0 comments on commit 7c1c137

Please sign in to comment.