-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
JsonSerializer.Serialize stopped working with Blazor, throws MethodAccessException #55568
Comments
Tagging subscribers to this area: @eiriktsarpalis, @layomia Issue DetailsDescriptionWhen calling
steps to reproduce:
public class Test
{
public int X { get; set; }
public int Y { get; set; }
}
string json = JsonSerializer.Serialize(new Test { Y = 1, X = 2 });
Console.WriteLine(json); Configuration.NET version: 6.0.100-preview.5.21302.13 .csproj:
|
Thanks for opening this issue, @romfir. Did you happen to check if the issue still repros when using a slightly earlier build of System.Text.Json that doesn't contain the changes from #54526, e.g this build? |
cc @pranavkm is this sort of issue familiar to you? Do you know why this method call could be failing with |
|
@romfir does it repro when you disable trimming in the csproj? <PropertyGroup>
<PublishTrimmed>false</PublishTrimmed>
</PropertyGroup> |
It does repro, but I don't think it matter, because I'm launching it via F5 with debug, without publishing |
Thanks, I'll take a closer look here. |
|
@stepht does the newer SDK fix the issue on Blazor? If so, this issue should be closed. Thanks |
My issue is fixed, I don't know what's with @romfir. |
using rc.1 builds it no longer throws. |
Description
When calling
JsonSerializer.Serialize
code throws MethodAccessException:steps to reproduce:
Counter.razor
add two lines toIncrementCount()
:Configuration
.NET version: 6.0.100-preview.5.21302.13
.csproj:
The text was updated successfully, but these errors were encountered: