Skip to content

Visual Studio error displaying .razor file #11486

Closed
dotnet/razor
#709
@JerryMcMillan

Description

@JerryMcMillan

I get an invalid operation exception in Visual Studio 2019 Preview, .NET Core 3 preview 4 when opening a .razor file. VS renders the text as white only and intellisense does not work.

When I check the error log:

System.InvalidOperationException: The file 'C:/Users/jerry/Desktop/vs/MetroLock/MetroLock/Pages/FetchData.razor' is not a descendent of the base path 'C:/Users/jerry/desktop/vs/MetroLock/MetroLock' ...

In the two paths, one of the "Desktop" is capitalized, the other is not. This is fixed by moving my project to a lower case only directory. I looked really quick at the file DefaultRazorProjectFileSystem.cs and one possible fix would be on line 53

if (!absolutePath.StartsWith(absoluteBasePath))

could be changed to:

if (!absolutePath.StartsWith(absoluteBasePath, StringComparison.OrdinalIgnoreCase))

I hope this helps,

Thanks!

Metadata

Metadata

Assignees

Labels

DoneThis issue has been fixedarea-blazorIncludes: Blazor, Razor ComponentsbugThis issue describes a behavior which is not expected - a bug.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions