Skip to content

Commit bae304e

Browse files
committed
Build fix
1 parent 99f9e1e commit bae304e

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

projects/RabbitMQ.Client/client/api/ICredentialsRefresher.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131

3232
using System;
3333
using System.Collections.Concurrent;
34+
using System.Diagnostics.CodeAnalysis;
3435
using System.Diagnostics.Tracing;
3536
using System.Timers;
3637

projects/RabbitMQ.Client/client/logging/RabbitMqClientEventSource.cs

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,13 @@
3030
//---------------------------------------------------------------------------
3131

3232
using System;
33+
using System.Diagnostics.CodeAnalysis;
3334
using System.Diagnostics.Tracing;
3435

3536
namespace RabbitMQ.Client.Logging
3637
{
3738
[EventSource(Name = "rabbitmq-dotnet-client")]
38-
public sealed class RabbitMqClientEventSource : EventSource
39+
internal sealed partial class RabbitMqClientEventSource : EventSource
3940
{
4041
public class Keywords
4142
{
@@ -46,7 +47,7 @@ public RabbitMqClientEventSource() : base(EventSourceSettings.EtwSelfDescribingE
4647
{
4748
}
4849

49-
public static RabbitMqClientEventSource Log = new RabbitMqClientEventSource();
50+
public static readonly RabbitMqClientEventSource Log = new RabbitMqClientEventSource();
5051

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

73-
[UnconditionalSuppressMessage("Trimming", "IL2026", Justification = "The properties are preserved with the DynamicallyAccessedMembers attribute.")]
74-
void WriteExceptionEvent<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties)] T>(string message, T ex)
75-
{
76-
WriteEvent(3, message, ex);
77-
}
7874
#else
7975
WriteEvent(3, message, ex);
8076
#endif
@@ -86,5 +82,13 @@ public void Error(string message, Exception ex)
8682
{
8783
Error(message, new RabbitMqExceptionDetail(ex));
8884
}
85+
86+
#if NET6_0_OR_GREATER
87+
[UnconditionalSuppressMessage("Trimming", "IL2026", Justification = "The properties are preserved with the DynamicallyAccessedMembers attribute.")]
88+
private void WriteExceptionEvent<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties)] T>(string message, T ex)
89+
{
90+
WriteEvent(3, message, ex);
91+
}
92+
#endif
8993
}
9094
}

0 commit comments

Comments
 (0)