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

TypeFeatureProvider throws if a Razor Page has no PageModel #11904

Closed
jtkech opened this issue Jun 27, 2022 · 0 comments · Fixed by #11905
Closed

TypeFeatureProvider throws if a Razor Page has no PageModel #11904

jtkech opened this issue Jun 27, 2022 · 0 comments · Fixed by #11905
Milestone

Comments

@jtkech
Copy link
Member

jtkech commented Jun 27, 2022

Describe the bug

We now can use the [Feature()] attribute on a razor PageModel and we use the ITypeFeatureProvider to retrieve the feature related to a given PageModel. The problem is that when no PageModel is defined for a razor page, e.g. only @functions handlers, the related page ModelType is then of type Object.

In that case ITypeFeatureProvider.GetFeatureForDependency(pageModelType) throw an exception.

To Reproduce

Steps to reproduce the behavior:

  1. Create a Razor @page without defining a PageModel (e.g. only @functions handlers).
  2. Start the app and see _typeFeatureProvider failing.

Expected behavior

A Razor @page without defining a PageModel should work.

Fixed on my side, will push a PR

LombiqBot pushed a commit to Lombiq/OrchardCore that referenced this issue Jun 30, 2022
… no PageModel (OrchardCMS#11905)

* Update ModularPageApplicationModelProvider.cs

* Create HelloWorld.cshtml
@sebastienros sebastienros added this to the 1.x milestone Jun 30, 2022
@Skrypt Skrypt modified the milestones: 1.x, 1.5 Nov 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants