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

Stop Calling JSON GetTypeInfo with the runtime type #47859

Merged
merged 6 commits into from
Apr 25, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Add justifications for suppressing the warnings from JsonSerializer.
  • Loading branch information
eerhardt committed Apr 25, 2023
commit c0868a1ae57fcec280e83f28b3d703488bd371a0
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ private static Func<HttpContext, StringValues> ResolveFromRouteOrQuery(string pa

public static string WriteToResponseAsyncMethod => """
[UnconditionalSuppressMessage("Trimming", "IL2026:RequiresUnreferencedCode",
Justification = "<Pending>")]
Justification = "The 'JsonSerializer.IsReflectionEnabledByDefault' feature switch, which is set to false by default for trimmed ASP.NET apps, ensures the JsonSerializer doesn't use Reflection.")]
[UnconditionalSuppressMessage("AOT", "IL3050:RequiresDynamicCode", Justification = "See above.")]
private static Task WriteToResponseAsync<T>(T? value, HttpContext httpContext, JsonTypeInfo<T> jsonTypeInfo, JsonSerializerOptions options)
eerhardt marked this conversation as resolved.
Show resolved Hide resolved
{
Expand Down
2 changes: 1 addition & 1 deletion src/Http/Http.Results/src/HttpResultsHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ internal static partial class HttpResultsHelper
private static readonly Encoding DefaultEncoding = Encoding.UTF8;

[UnconditionalSuppressMessage("Trimming", "IL2026:RequiresUnreferencedCode",
Justification = "<Pending>")]
Justification = "The 'JsonSerializer.IsReflectionEnabledByDefault' feature switch, which is set to false by default for trimmed ASP.NET apps, ensures the JsonSerializer doesn't use Reflection.")]
[UnconditionalSuppressMessage("AOT", "IL3050:RequiresDynamicCode", Justification = "See above.")]
public static Task WriteResultAsJsonAsync<TValue>(
HttpContext httpContext,
Expand Down
2 changes: 1 addition & 1 deletion src/Shared/RouteHandlers/ExecuteHandlerHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public static void SetPlaintextContentType(HttpContext httpContext)
}

[UnconditionalSuppressMessage("Trimming", "IL2026:RequiresUnreferencedCode",
Justification = "<Pending>")]
Justification = "The 'JsonSerializer.IsReflectionEnabledByDefault' feature switch, which is set to false by default for trimmed ASP.NET apps, ensures the JsonSerializer doesn't use Reflection.")]
[UnconditionalSuppressMessage("AOT", "IL3050:RequiresDynamicCode", Justification = "See above.")]
public static Task WriteJsonResponseAsync<T>(HttpResponse response, T? value, JsonSerializerOptions options, JsonTypeInfo<T> jsonTypeInfo)
{
Expand Down