razor: FallbackProjectManager - Project not loading - [Razor file] is not a descendent of the base path

After upgrading to Visual Studio 17.8, when I try to load my solution, a project I have that includes razor files via links fails to load (intentionally not under base path)

VsProjectFault is :

LimitedFunctionality System.AggregateException: Project system data flow ‘Workspace update handler 58527731’ closed because of an exception: The file ‘C:/client/bin/…/example.cshtml’ is not a descendent of the base path ‘C:/server/src/Service’… —> (Inner Exception #0) System.InvalidOperationException: The file ‘C:/paclient/bin/Debug.AnyCPU/AppMagic/WebPlayer/WebPlayerResources/WebPlayerResources/TransformedViews/WebPlayer/tr-TR-SF_UnifiedApp.cshtml’ is not a descendent of the base path ‘C:/paserver/src/WebPlayer.Service’. at Microsoft.AspNetCore.Razor.Language.DefaultRazorProjectFileSystem.GetItem(String path, String fileKind) at Microsoft.CodeAnalysis.Razor.ProjectSystem.ProjectState.GetImportDocumentTargetPaths(HostDocument hostDocument) at Microsoft.CodeAnalysis.Razor.ProjectSystem.ProjectState.WithAddedHostDocument(HostDocument hostDocument, Func`1 loader) at Microsoft.CodeAnalysis.Razor.ProjectSystem.DefaultProjectSnapshotManager.Change(Entry originalEntry, IUpdateProjectAction action, DocumentState documentState) at Microsoft.CodeAnalysis.Razor.ProjectSystem.DefaultProjectSnapshotManager.TryChangeEntry_UsesLock(ProjectKey projectKey, String documentFilePath, IUpdateProjectAction action, IProjectSnapshot& oldSnapshot, IProjectSnapshot& newSnapshot) at Microsoft.CodeAnalysis.Razor.ProjectSystem.DefaultProjectSnapshotManager.DocumentAdded(ProjectKey projectKey, HostDocument document, TextLoader textLoader) at Microsoft.CodeAnalysis.Razor.ProjectSystem.FallbackProjectManager.AddFallbackDocument(ProjectKey projectKey, String filePath, String projectFilePath) at Microsoft.CodeAnalysis.Razor.ProjectSystem.FallbackProjectManager.AddFallbackProject(ProjectId projectId, String filePath) at Microsoft.CodeAnalysis.Razor.ProjectSystem.FallbackProjectManager.DynamicFileAdded(ProjectId projectId, ProjectKey razorProjectKey, String projectFilePath, String filePath) at Microsoft.CodeAnalysis.Razor.Workspaces.DefaultRazorDynamicFileInfoProvider.GetDynamicFileInfoAsync(ProjectId projectId, String projectFilePath, String filePath, CancellationToken cancellationToken) at Microsoft.CodeAnalysis.ExternalAccess.Razor.RazorDynamicFileInfoProviderWrapper.<GetDynamicFileInfoAsync>d__7.MoveNext()

It looks like this might be related to #9470 - is there a way to get the project to load correctly, eg: skip FallbackProjectManager?

#4614 might be related as well.

About this issue

  • Original URL
  • State: closed
  • Created 8 months ago
  • Comments: 27 (11 by maintainers)

Most upvoted comments

Did it miss the cut for 17.8.2 as well? This issue is more than just an annoyance, the project will not load and crash. Is there an estimate for the release a fix will be included in?

Unfortunately the fix didn’t make the cut for 17.8.1. Servicing releases like that have a relatively high bar for the types of changes that can be accepted, and the power that be decided ours is not important enough. That might change for a future servicing release, but otherwise the fix should be in the next preview orf 17.9, when that is released. Unfortunately there is nothing I can do but apologize for the wait.

Indeed, that is the cause. Thanks for the info. Have a PR out with the fix now, just need to work out where to put it 😃

This fix has been merged into 17.8.3 and 17.9 Preview 2

The reason it was missed is the same reason it didn’t make the cut for 17.8.1: extremely few users have razor files in shared projects. Yes it sucks when you’re one of the few who do, but there are millions of users of Visual Studio and servicing is taken very seriously by the people in charge.

The good news is, we’re trying again to get the fix into a future 17.8 updatex, and things are looking positive it will make the cut this time.

Did it miss the cut for 17.8.2 as well? This issue is more than just an annoyance, the project will not load and crash. Is there an estimate for the release a fix will be included in?

I agree, not sure why this problem was not given the significance it deserve.

Thank you so much for the extra info

@rggammon thanks for reporting the issue. Is it possible for you to share your project, or create a small repro project that demonstrates the issue? I’m guessing you have something like <Compile Include="../../../<etc." /> in your project file? Do you have a Link property set on the files included from another project?

In general the Razor project system has never handled this situation too well, and there are various checks that verify and/or assume that a Razor file is in a child folder of the project file, however it is very possible that the new fallback project system is not handling it as gracefully.

The workaround, for now, would be to copy those files rather than linking them, if possible.