-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Blazor: Preview9 made HtmlRenderer & ComponentRenderedText internal #13687
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
Comments
I would like to add, that having an easy to use API, that can use/by default uses the same service provider as the renderer it is inside to turn a renderfragment into a string, will likely be a great addition to the Blazor library. I'm pretty sure there are going to be other devs out there who will need this feature but won't have the @SteveSandersonMS chops to create a custom renderer for their purpose either :-) |
Yep, this one is quite a bummer and rendered (pun intended) Radzen's Blazor design time not working. |
In the past the APIs for accessing the data for producing the HTML were internal (private protected if I recall) but now they are public, so you can do the same thing HTML Renderer does yourself. Let me know if you run into any roadblocks. Personally I would like to also bring this back on a future release, but I would like to make some API changes to improve performance. |
@javiercn it uses an internal struct https://github.com/aspnet/AspNetCore/blob/master/src/Mvc/Mvc.ViewFeatures/src/RazorComponents/ComponentRenderedText.cs Also there is this warning:
Other than that it seems to work. |
@javiercn its no problem copy-pasting your version of
@akorchev just suppress the warning. Its fair its there, since we are digging our feet into the low level APIs in Blazor. This works for me. Create a [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Reliability", "BL0006:The types in 'Microsoft.AspNetCore.Components.RenderTree' are not recommended for use outside of the Blazor framework. These type definitions will change in future releases.",
Justification = "I will take the chance",
Scope = "namespaceanddescendants",
Target = "<YOUR.NAMESPACE.HERE")] |
@javiercn well instead of using low-level Blazor API we could have just used the higher level and now internal HtmlRenderer ;) I am pretty sure those low-level APIs will break often and we will find that out after the release (as it happened now). @javiercn What is the reasoning of having public low-level warning-producing API instead of public HtmlRenderer? |
@akorchev The API in its current form is not very good. @danroth27 Given the interest on this API can we consider the appropriate improvements in HtmlRenderer to make it public in 3.1? I don't think we should release the API in its current form if we have time to make it performant before 3.1. It should take 2 days tops. |
People can easily copy the relevant bits of the |
@javiercn / @SteveSandersonMS just for the record, I am fine with doing a little copy/paste for now. It would however be lovely with a better API (and more performance). It doesn't have to become public in the close future, as long as you keep it reasonably copy-pastable while iterating on it. |
@SteveSandersonMS If there's demand for it and prevents people using the pubternal API I think it brings goodness. |
@javiercn @SteveSandersonMS are there any planned changes in the |
@akorchev No render tree API changes are expected between preview 9 and final 3.0. |
What is status of this? Can we at this point (after 3.1) assume using GetFrames() is acceptable? Not being able to access it is a big limitation for more advanced Blazor scenarios. Some clear recommendation would be appreciated. |
Two Libraries (that I know of) use HtmlRenderer & ComponentRenderedText prior to previw 9. One is BlazorStyled: https://github.com/chanan/BlazorStyled and the other is Egil's testing library: https://github.com/egil/razor-components-testing-library
Both use it for the same reason, to get the content of ChildContent. It was used like so:
However as of Preview9 that is no longer possible as HtmlRenderer & ComponentRenderedText are both internal - Please make them public (Or provide another way to get the content of ChildContent).
CC: @danroth27 @SteveSandersonMS @egil
The text was updated successfully, but these errors were encountered: