Skip to content

Conversation

@eerhardt
Copy link
Member

Since #31626, the Web SDK is defaulting JsonSerializerIsReflectionEnabledByDefault=false whenever PublishTrimmed or PublishAot is set to true. However, this also affects Blazor WASM since it is importing the Web SDK. For Blazor WASM, we need to keep the normal default of JsonSerializerIsReflectionEnabledByDefault=true, so it doesn't break existing Blazor WASM apps that are relying on JsonSerializer using Reflection.

See discussion in dotnet/runtime#84378.

NOTE: I don't know how to test this at this layer. If anyone has a good recommendation for how to test it, I am open to suggestions.

@eerhardt eerhardt requested a review from a team as a code owner April 20, 2023 15:12
@ghost ghost added Area-AspNetCore RazorSDK, BlazorWebAssemblySDK, dotnet-watch untriaged Request triage from a team member labels Apr 20, 2023
@ghost
Copy link

ghost commented Apr 20, 2023

Thanks for your PR, @eerhardt.
To learn about the PR process and branching schedule of this repo, please take a look at the SDK PR Guide.

@eerhardt eerhardt requested a review from JamesNK April 20, 2023 15:14
<SuppressTrimAnalysisWarnings Condition="'$(SuppressTrimAnalysisWarnings)' == '' And '$(TrimmerDefaultAction)' != 'link'">true</SuppressTrimAnalysisWarnings>

<!-- Similarly these feature switches must be configured before they are initialized in imported SDKs -->
<JsonSerializerIsReflectionEnabledByDefault Condition="'$(JsonSerializerIsReflectionEnabledByDefault)' == ''">true</JsonSerializerIsReflectionEnabledByDefault>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this need any testing?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See the note in the top comment.

NOTE: I don't know how to test this at this layer. If anyone has a good recommendation for how to test it, I am open to suggestions.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAIK blazor apps don't run here. So best way to test it is to locally run blazor app with the built SDK.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can't be disabled for blazor apps, if the user disables this, we should emit an error instead in the context of blazor webassembly apps or simply ignore the user choice.

The framework is dependent on this feature for basic functionality (JS interop)

@lewing lewing requested a review from maraf April 20, 2023 16:05
Copy link
Member

@maraf maraf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's ok to leave this change affecting only blazor, not vanilla wasm SDK, since that doesn't have an existing user base expecting it to work this way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area-AspNetCore RazorSDK, BlazorWebAssemblySDK, dotnet-watch untriaged Request triage from a team member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants