Skip to content

Commit 04910bb

Browse files
committed
Cleanup
1 parent d758ef8 commit 04910bb

File tree

5 files changed

+8
-53
lines changed

5 files changed

+8
-53
lines changed

src/Components/Shared/src/DefaultAntiforgeryStateProvider.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public DefaultAntiforgeryStateProvider(PersistentComponentState state)
2828
{
2929
var bytes = JsonSerializer.SerializeToUtf8Bytes(
3030
GetAntiforgeryToken(),
31-
DefaultAntiforgeryStateProviderSerializerContext.Default.AntiforgeryRequestToken);
31+
DefaultAntiforgeryStateProviderJsonSerializerContext.Default.AntiforgeryRequestToken);
3232
state.PersistAsJson(PersistenceKey, bytes);
3333
return Task.CompletedTask;
3434
}, RenderMode.InteractiveAuto);
@@ -37,7 +37,7 @@ public DefaultAntiforgeryStateProvider(PersistentComponentState state)
3737
{
3838
_currentToken = JsonSerializer.Deserialize(
3939
bytes,
40-
DefaultAntiforgeryStateProviderSerializerContext.Default.AntiforgeryRequestToken);
40+
DefaultAntiforgeryStateProviderJsonSerializerContext.Default.AntiforgeryRequestToken);
4141
}
4242
}
4343

@@ -49,4 +49,4 @@ public DefaultAntiforgeryStateProvider(PersistentComponentState state)
4949
}
5050

5151
[JsonSerializable(typeof(AntiforgeryRequestToken))]
52-
internal sealed partial class DefaultAntiforgeryStateProviderSerializerContext : JsonSerializerContext;
52+
internal sealed partial class DefaultAntiforgeryStateProviderJsonSerializerContext : JsonSerializerContext;

src/Components/WebAssembly/WebAssembly/src/Services/DefaultWebAssemblyJSRuntime.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ internal sealed partial class DefaultWebAssemblyJSRuntime : WebAssemblyJSRuntime
1919
{
2020
private static readonly JsonSerializerOptions _rootComponentSerializerOptions = new(WebAssemblyComponentSerializationSettings.JsonSerializationOptions)
2121
{
22-
TypeInfoResolver = DefaultWebAssemblyJSRuntimeSerializerContext.Default,
22+
TypeInfoResolver = DefaultWebAssemblyJSRuntimeJsonSerializerContext.Default,
2323
};
2424

2525
public static readonly DefaultWebAssemblyJSRuntime Instance = new();
@@ -172,4 +172,4 @@ protected override Task TransmitStreamAsync(long streamId, DotNetStreamReference
172172
}
173173

174174
[JsonSerializable(typeof(RootComponentOperationBatch))]
175-
internal sealed partial class DefaultWebAssemblyJSRuntimeSerializerContext : JsonSerializerContext;
175+
internal sealed partial class DefaultWebAssemblyJSRuntimeJsonSerializerContext : JsonSerializerContext;

src/Components/test/testassets/Components.TestServer/RazorComponents/App.razor

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,6 @@
7070
});
7171
}
7272
},
73-
configureRuntime: (builder) => {
74-
builder.withConfig({
75-
browserProfilerOptions: {},
76-
});
77-
},
7873
},
7974
}).then(() => {
8075
const startedParagraph = document.createElement('p');

src/Components/test/testassets/Components.WasmMinimal/Components.WasmMinimal.csproj

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@
55
<Nullable>enable</Nullable>
66
<ImplicitUsings>enable</ImplicitUsings>
77
<StaticWebAssetBasePath>WasmMinimal</StaticWebAssetBasePath>
8-
9-
<WasmProfilers>browser;</WasmProfilers>
10-
<WasmBuildNative>true</WasmBuildNative>
118
</PropertyGroup>
129

1310
<ItemGroup>

src/JSInterop/Microsoft.JSInterop/src/JSRuntime.cs

Lines changed: 3 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,7 @@
44
using System.Collections.Concurrent;
55
using System.Diagnostics;
66
using System.Diagnostics.CodeAnalysis;
7-
using System.Linq;
87
using System.Text.Json;
9-
using System.Text.Json.Serialization;
10-
using System.Text.Json.Serialization.Metadata;
118
using Microsoft.JSInterop.Infrastructure;
129
using static Microsoft.AspNetCore.Internal.LinkerFlags;
1310

@@ -236,16 +233,9 @@ internal bool EndInvokeJS(long taskId, bool succeeded, ref Utf8JsonReader jsonRe
236233
if (succeeded)
237234
{
238235
var resultType = interopTask.ResultType;
239-
240-
object? result;
241-
if (resultType == typeof(IJSVoidResult))
242-
{
243-
result = null;
244-
}
245-
else
246-
{
247-
result = JsonSerializer.Deserialize(ref jsonReader, resultType, interopTask.DeserializeOptions);
248-
}
236+
var result = resultType == typeof(IJSVoidResult)
237+
? null
238+
: JsonSerializer.Deserialize(ref jsonReader, resultType, interopTask.DeserializeOptions);
249239

250240
ByteArraysToBeRevived.Clear();
251241
interopTask.SetResult(result);
@@ -343,30 +333,3 @@ internal IDotNetObjectReference GetObjectReference(long dotNetObjectId)
343333
/// </summary>
344334
public void Dispose() => ByteArraysToBeRevived.Dispose();
345335
}
346-
347-
[UnconditionalSuppressMessage("Trimming", "IL2026", Justification = "We enforce trimmer attributes for JSON deserialized types on InvokeAsync")]
348-
internal sealed class FallbackTypeInfoResolver : IJsonTypeInfoResolver
349-
{
350-
private static readonly DefaultJsonTypeInfoResolver _defaultJsonTypeInfoResolver = new();
351-
352-
public static readonly FallbackTypeInfoResolver Instance = new();
353-
354-
public JsonTypeInfo? GetTypeInfo(Type type, JsonSerializerOptions options)
355-
{
356-
if (options.Converters.Any(c => c.CanConvert(type)))
357-
{
358-
// TODO: We should allow types with custom converters to be serialized without
359-
// having to generate metadata for them.
360-
// Question: Why do we even need a JsonTypeInfo if the type is going to be serialized
361-
// with a custom converter anyway? We shouldn't need to perform any reflection here.
362-
// Is it possible to generate a "minimal" JsonTypeInfo that just points to the correct
363-
// converter?
364-
return _defaultJsonTypeInfoResolver.GetTypeInfo(type, options);
365-
}
366-
367-
return null;
368-
}
369-
}
370-
371-
[JsonSerializable(typeof(object[]))] // JS interop argument lists are always object arrays
372-
internal sealed partial class JSRuntimeSerializerContext : JsonSerializerContext;

0 commit comments

Comments
 (0)