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

[Core] Adding AOT attributes for warnings reported when using .NET 8 RC2 #39428

Merged
merged 1 commit into from
Oct 26, 2023
Merged
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
12 changes: 12 additions & 0 deletions sdk/core/Azure.Core/src/Diagnostics/AzureCoreEventSource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public void Request(Request request, string? assemblyName, HttpMessageSanitizer
}

[Event(RequestEvent, Level = EventLevel.Informational, Message = "Request [{0}] {1} {2}\r\n{3}client assembly: {4}")]
[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026", Justification = "WriteEvent is used with primitive types.")]
public void Request(string requestId, string method, string uri, string headers, string? clientAssembly)
{
WriteEvent(RequestEvent, requestId, method, uri, headers, clientAssembly);
Expand All @@ -78,6 +79,7 @@ public void RequestContent(string requestId, byte[] content, Encoding? textEncod
}

[Event(RequestContentEvent, Level = EventLevel.Verbose, Message = "Request [{0}] content: {1}")]
[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026", Justification = "WriteEvent is used with an array with primitive type elements.")]
public void RequestContent(string requestId, byte[] content)
m-redding marked this conversation as resolved.
Show resolved Hide resolved
{
WriteEvent(RequestContentEvent, requestId, content);
Expand All @@ -99,6 +101,7 @@ public void Response(Response response, HttpMessageSanitizer sanitizer, double e
}

[Event(ResponseEvent, Level = EventLevel.Informational, Message = "Response [{0}] {1} {2} ({4:00.0}s)\r\n{3}")]
[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026", Justification = "WriteEvent is used with primitive types.")]
public void Response(string requestId, int status, string reasonPhrase, string headers, double seconds)
{
WriteEvent(ResponseEvent, requestId, status, reasonPhrase, headers, seconds);
Expand All @@ -121,6 +124,7 @@ public void ResponseContent(string requestId, byte[] content, Encoding? textEnco
}

[Event(ResponseContentEvent, Level = EventLevel.Verbose, Message = "Response [{0}] content: {1}")]
[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026", Justification = "WriteEvent is used with an array with primitive type elements.")]
public void ResponseContent(string requestId, byte[] content)
{
WriteEvent(ResponseContentEvent, requestId, content);
Expand Down Expand Up @@ -149,12 +153,14 @@ public void ResponseContentBlock(string requestId, int blockNumber, byte[] conte
}

[Event(ResponseContentBlockEvent, Level = EventLevel.Verbose, Message = "Response [{0}] content block {1}: {2}")]
[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026", Justification = "WriteEvent is used with an array with primitive type elements.")]
public void ResponseContentBlock(string requestId, int blockNumber, byte[] content)
{
WriteEvent(ResponseContentBlockEvent, requestId, blockNumber, content);
}

[Event(ResponseContentTextBlockEvent, Level = EventLevel.Verbose, Message = "Response [{0}] content block {1}: {2}")]
[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026", Justification = "WriteEvent is used with primitive types.")]
public void ResponseContentTextBlock(string requestId, int blockNumber, string content)
{
WriteEvent(ResponseContentTextBlockEvent, requestId, blockNumber, content);
Expand All @@ -170,6 +176,7 @@ public void ErrorResponse(Response response, HttpMessageSanitizer sanitizer, dou
}

[Event(ErrorResponseEvent, Level = EventLevel.Warning, Message = "Error response [{0}] {1} {2} ({4:00.0}s)\r\n{3}")]
[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026", Justification = "WriteEvent is used with primitive types.")]
public void ErrorResponse(string requestId, int status, string reasonPhrase, string headers, double seconds)
{
WriteEvent(ErrorResponseEvent, requestId, status, reasonPhrase, headers, seconds);
Expand All @@ -192,6 +199,7 @@ public void ErrorResponseContent(string requestId, byte[] content, Encoding? tex
}

[Event(ErrorResponseContentEvent, Level = EventLevel.Informational, Message = "Error response [{0}] content: {1}")]
[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026", Justification = "WriteEvent is used with an array with primitive type elements.")]
public void ErrorResponseContent(string requestId, byte[] content)
{
WriteEvent(ErrorResponseContentEvent, requestId, content);
Expand Down Expand Up @@ -220,12 +228,14 @@ public void ErrorResponseContentBlock(string requestId, int blockNumber, byte[]
}

[Event(ErrorResponseContentBlockEvent, Level = EventLevel.Informational, Message = "Error response [{0}] content block {1}: {2}")]
[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026", Justification = "WriteEvent is used with an array with primitive type elements.")]
public void ErrorResponseContentBlock(string requestId, int blockNumber, byte[] content)
{
WriteEvent(ErrorResponseContentBlockEvent, requestId, blockNumber, content);
}

[Event(ErrorResponseContentTextBlockEvent, Level = EventLevel.Informational, Message = "Error response [{0}] content block {1}: {2}")]
[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026", Justification = "WriteEvent is used with primitive types.")]
public void ErrorResponseContentTextBlock(string requestId, int blockNumber, string content)
{
WriteEvent(ErrorResponseContentTextBlockEvent, requestId, blockNumber, content);
Expand All @@ -239,6 +249,7 @@ public void RequestRetrying(string requestId, int retryNumber, double seconds)
}

[Event(ResponseDelayEvent, Level = EventLevel.Warning, Message = "Response [{0}] took {1:00.0}s")]
[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026", Justification = "WriteEvent is used with primitive types.")]
public void ResponseDelay(string requestId, double seconds)
{
WriteEvent(ResponseDelayEvent, requestId, seconds);
Expand All @@ -260,6 +271,7 @@ public void RequestRedirect(Request request, Uri redirectUri, Response response)
}

[Event(RequestRedirectEvent, Level = EventLevel.Verbose, Message = "Request [{0}] Redirecting from {1} to {2} in response to status code {3}")]
[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026", Justification = "WriteEvent is used with primitive types.")]
public void RequestRedirect(string requestId, string from, string to, int status)
{
WriteEvent(RequestRedirectEvent, requestId, from, to, status);
Expand Down