Skip to content

Conversation

guardrex
Copy link
Collaborator

@guardrex guardrex commented Sep 4, 2025

Addresses #34437
Fixes #35897
Fixes #35972
Fixes #35360
Fixes #36070

Notes

  • I searched for other items to cover for RC1, but I didn't find anything else.

  • Sorry that this time I couldn't set up one commit per feature. There were feature changes across commits this time.

  • In aspnetcore/mvc/models/validation.md for the Built-in attributes section, some common attributes are listed. Instead of the arbitrary list and having to version to get new ones shown, I recommend that we just cross-link the API Browser ...

    For a complete list of validation attributes, see the <xref:System.ComponentModel.DataAnnotations?displayProperty=fullName> namespace.

    I'm holding on to the old table locally. Note that if you want the table instead of the cross-link that I'm going to need to copy the entire table (version the whole thing) to get the new [SkipValidation] attribute listed.


Internal previews

📄 File 🔗 Preview link
aspnetcore/blazor/forms/validation.md aspnetcore/blazor/forms/validation
aspnetcore/blazor/fundamentals/routing.md aspnetcore/blazor/fundamentals/routing
aspnetcore/blazor/host-and-deploy/configure-trimmer.md aspnetcore/blazor/host-and-deploy/configure-trimmer
aspnetcore/blazor/javascript-interoperability/index.md aspnetcore/blazor/javascript-interoperability/index
aspnetcore/blazor/state-management/prerendered-state-persistence.md aspnetcore/blazor/state-management/prerendered-state-persistence
aspnetcore/fundamentals/minimal-apis.md aspnetcore/fundamentals/minimal-apis
aspnetcore/migration/90-to-100.md aspnetcore/migration/90-to-100
aspnetcore/mvc/models/validation.md aspnetcore/mvc/models/validation

@guardrex guardrex self-assigned this Sep 4, 2025
@guardrex guardrex force-pushed the guardrex/blazor-rc1 branch from 26c419a to c738aba Compare September 8, 2025 17:51
@guardrex guardrex marked this pull request as ready for review September 8, 2025 19:38
## Failure to preserve types used by a published app

Trimming may have detrimental effects for a published app leading to runtime errors. In apps that use [reflection](/dotnet/csharp/advanced-topics/reflection-and-attributes/), the IL Trimmer often can't determine the required types for runtime reflection and trims them away or trims away parameter names from methods. This can happen with complex framework types used for JS interop, JSON serialization/deserialization, and other operations.
Trimming may have detrimental effects for a published app leading to runtime errors, even in spite of setting the [`<PublishTrimmed>` property](#configuration) to `false` in the project file. In apps that use [reflection](/dotnet/csharp/advanced-topics/reflection-and-attributes/), the IL Trimmer often can't determine the required types for runtime reflection and trims them away or trims away parameter names from methods. This can happen with complex framework types used for JS interop, JSON serialization/deserialization, and other operations.
Copy link
Member

Choose a reason for hiding this comment

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

even in spite of setting the <PublishTrimmed> property to false

This doesn't sound right. Setting PublishTrimmed to false should disable trimming for the entire app. Does this not work? If it doesn't, I think it's a bug that we should fix, not document.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'll double check this in the morning and report back.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@danroth27 ... Confirmed!

image image

Copy link
Member

Choose a reason for hiding this comment

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

@gaurdrex Can you create an issue for this in the dotnet/aspnetcore repo and share your project with us?

Copy link
Collaborator Author

@guardrex guardrex Sep 9, 2025

Choose a reason for hiding this comment

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

@danroth27 ... Isn't this the same as (or at least has the elements of) dotnet/aspnetcore#52947? It's just not KeyValuePair ... it's a Tuple ... but same situation/error. I thought @javiercn was well aware of this, and I placed the content that he requested to cover it. I just want to make sure I'm opening an issue that @javiercn won't close saying that it can never be fixed outside of the approaches provided ... in order: use a custom type (any .NET), Dynamic Dependency (.NET 5+), Root Descriptor (.NET 10+), <_ExtraTrimmerArgs> (.NET 8 workaround).

Copy link
Collaborator Author

@guardrex guardrex Sep 9, 2025

Choose a reason for hiding this comment

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

... and @danroth27 ... are we holding this PR past the RC1 release if @javiercn doesn't respond by then?

Copy link
Member

Choose a reason for hiding this comment

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

Isn't this the same as (or at least has the elements of) dotnet/aspnetcore#52947? It's just not KeyValuePair ... it's a Tuple ... but same situation/error. I thought @javiercn was well aware of this, and I placed the content that he requested to cover it.

Right, that's why I thought @javiercn might want to review this content.

are we holding this PR past the RC1 release if @javiercn doesn't respond by then?

Nope, no need to block on this. The content looks fine to me.

Copy link
Collaborator Author

@guardrex guardrex Sep 9, 2025

Choose a reason for hiding this comment

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

I just asked because you were calling for his review. I'll react with a patch PR later if he has any changes.

... and I thought Javier would just re-open the existing PU issue on that subject, but I'm still 👂 if you/he want a new issue on ConstructorContainsNullParameterNames.

Copy link
Member

Choose a reason for hiding this comment

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

We did KeyValuePair because people use that.

If get reports for other types, we might choose to add those too. The cost of preserving a type is small compared to the benefit of not having to force people into doing this type of stuff if enough people use the type.


For more information, see [Trimming options (.NET documentation)](/dotnet/core/deploying/trimming/trimming-options#trimming-granularity).

## Failure to preserve types used by a published app
Copy link
Member

Choose a reason for hiding this comment

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

@javiercn Can you review the recommendations made in this section for dealing with type preservation for JS interop related scenarios?

Copy link
Member

Choose a reason for hiding this comment

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

@javiercn Is there more you want to add here for handling persistent component state with enhanced nav?

Copy link
Member

@danroth27 danroth27 left a comment

Choose a reason for hiding this comment

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

I have a few comments, but given time is short I'm going to go ahead and approve this. I'm happy to check early in the morning for updates in case there are any questions or concerns about any of my comments.

@guardrex
Copy link
Collaborator Author

guardrex commented Sep 9, 2025

@danroth27 @javiercn @oroztocil ... Updates made ... and there were quite a few, so a new look 👁️ is a good idea.

I still need ...

  • Anything that you want to change about what is stated on the ineffectiveness of <PublishTrimmed>, which doesn't stop trimming of the types. We've published that remark for quite a while now, and I don't think we can pull it until the framework changes because devs wrote in confused why it wasn't working.
  • DR's pings for Javier to comment ☝️.

If possible, I'd like to merge this PR no later than noon EST (9am PST). It won't go live until the Merge-to-Live PR goes in at release time.

@guardrex guardrex merged commit d024f41 into main Sep 9, 2025
3 checks passed
@guardrex guardrex deleted the guardrex/blazor-rc1 branch September 9, 2025 15:50
@guardrex guardrex mentioned this pull request Sep 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants