Skip to content
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

[Blazor|Mvc] Make Microsoft.AspNetCore.Mvc.ViewFeatures.IComponentRenderer public #21666

Closed
JvanderStad opened this issue May 10, 2020 · 3 comments
Labels
affected-few This issue impacts only small number of customers area-blazor Includes: Blazor, Razor Components enhancement This issue represents an ask for new feature or an enhancement to an existing one feature-prerendering Issues related to prerendering blazor components severity-major This label is used by an internal tool
Milestone

Comments

@JvanderStad
Copy link

I have my own version of ComponentTagHelper

https://github.com/dotnet/aspnetcore/blob/master/src/Mvc/Mvc.TagHelpers/src/ComponentTagHelper.cs#L101

var componentRenderer = ViewContext.HttpContext.RequestServices.GetRequiredService<IComponentRenderer>();
var result = await componentRenderer.RenderComponentAsync(ViewContext, ComponentType, RenderMode, _parameters);

However Microsoft.AspNetCore.Mvc.ViewFeatures.IComponentRenderer is not marked as public.
To work around this, I use reflection.

var type = Type.GetType("Microsoft.AspNetCore.Mvc.ViewFeatures.IComponentRenderer, Microsoft.AspNetCore.Mvc.ViewFeatures, Version=3.1.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60");
var componentRenderer = ViewContext.HttpContext.RequestServices.GetRequiredService(type);

var method = type.GetMethod("RenderComponentAsync");
Parameters[nameof(CascadingAuthenticationStateComponent.ComponentType)] = ComponentType.AssemblyQualifiedName;

var result = await (Task<IHtmlContent>)method.Invoke(componentRenderer, new object[] { ViewContext, typeof(CascadingAuthenticationStateComponent), RenderMode, Parameters });

please make IComponentRenderer public.

https://github.com/dotnet/aspnetcore/blob/602cb1dea59751a1297d674cddf7f0729c23e6ca/src/Mvc/Mvc.ViewFeatures/src/RazorComponents/IComponentRenderer.cs

@mkArtakMSFT mkArtakMSFT added the area-blazor Includes: Blazor, Razor Components label May 11, 2020
@JvanderStad
Copy link
Author

Technically it's in area-mvc, because it's a taghelper

@JvanderStad JvanderStad changed the title [Blazor] Make Microsoft.AspNetCore.Mvc.ViewFeatures.IComponentRenderer public [Blazor|Mvc] Make Microsoft.AspNetCore.Mvc.ViewFeatures.IComponentRenderer public May 11, 2020
@mkArtakMSFT mkArtakMSFT added the enhancement This issue represents an ask for new feature or an enhancement to an existing one label May 11, 2020
@mkArtakMSFT mkArtakMSFT added this to the Backlog milestone May 11, 2020
@mkArtakMSFT
Copy link
Member

We've moved this issue to the Backlog milestone. This means that it is not going to happen for the coming release. We will reassess the backlog following the current release and consider this item at that time. However, keep in mind that there are many other high priority features with which it will be competing for resources.

@captainsafia captainsafia added affected-few This issue impacts only small number of customers severity-major This label is used by an internal tool labels Oct 8, 2020
@javiercn javiercn added the feature-prerendering Issues related to prerendering blazor components label Apr 20, 2021
@mkArtakMSFT
Copy link
Member

Hi. Thanks for contacting us.
We're closing this issue as there was not much community interest in this ask for quite a while now.
You can learn more about our triage process and how we handle issues by reading our Triage Process writeup.

@mkArtakMSFT mkArtakMSFT closed this as not planned Won't fix, can't repro, duplicate, stale Oct 21, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Nov 21, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affected-few This issue impacts only small number of customers area-blazor Includes: Blazor, Razor Components enhancement This issue represents an ask for new feature or an enhancement to an existing one feature-prerendering Issues related to prerendering blazor components severity-major This label is used by an internal tool
Projects
None yet
Development

No branches or pull requests

4 participants