Skip to content

Editor config options not populated correctly for elements with special characters #52469

@captainsafia

Description

@captainsafia

Version Used:
3.10.0-3.21206.28

Steps to Reproduce:

  1. Create a new mvc project using dotnet new mvc -o TestFileNames.
  2. rename Views/Home/Index.cshtml Views/Home/{Index}.cshtml
  3. rename Views/Shared/Error.cshtml Views/Shared/#Error.cshtml
  4. dotnet build

Expected Behavior:

Compilations resolves correctly and we can resolve CompilerVisibleProperties correctly.

Actual Behavior:

The correct properties aren't resolved when using AnalyzerConfigOptions in the generator and you get the following compiler warnings.

CSC : warning InvalidGlobalSectionName: Global analyzer config section name '/Users/captainsafia/Verifications/TestFilesNames/Views/Home/{Index}.cshtml' is invalid as it is not an absolute path. Section will be ignored. Section was declared in file: '/Users/captainsafia/Verifications/TestFilesNames/obj/Debug/net6.0/TestFilesNames.GeneratedMSBuildEditorConfig.editorconfig' [/Users/captainsafia/Verifications/TestFilesNames/TestFilesNames.csproj]
CSC : warning RSG002: TargetPath not specified for additional file: /Users/captainsafia/Verifications/TestFilesNames/Views/Home/{Index}.cshtml. [/Users/captainsafia/Verifications/TestFilesNames/TestFilesNames.csproj]
CSC : warning RSG002: TargetPath not specified for additional file: /Users/captainsafia/Verifications/TestFilesNames/Views/Shared/#Error.cshtml. [/Users/captainsafia/Verifications/TestFilesNames/TestFilesNames.csproj]

The issue around the "#" in the filename is likely related to the issues around parsing characters that are considered comments in the editor config.

The issue with the "{" and "}" characters seems strange though. I haven't been able to find anything related to it in the issues.

Is there a workaround that can be employed in the meantime?

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions