ardalis / ardalis/OrganizingAspNetCore

Razor class libs

Open
#16 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
210
Forks
57
PR merge metrics
No merged PRs in 30d

Description

I noticed that if you are using razor class libs, the `controllerActionDescriptor` in `FeatureViewLocationExpander` will be null.
I added
```
if (controllerActionDescriptor == null)
{
// make sure shared stuff is searched for under the "features" folder
foreach (var location in viewLocations)
{
yield return location.Replace("Pages", "Features");
}
}
```
so that if a razor class lib would reference views/shared it still would be found. Let me know if you think this is a good idea, then I will make a pr.

Contributor guide

No contributing guide indexed for this repository

Research direction

Locate FeatureViewLocationExpander and investigate why controllerActionDescriptor is null when using Razor class libraries. Reproduce the views/shared lookup case described in the issue, then verify that shared views are found under the Features folder without breaking existing view-location behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.