Editorconfig value cannot be null

Solution to the error messages that is shown when an .editorconfig file fails to load in Visual Studio 2022.

Last updated on 11/21/2021


Solution

The simple way to resolve this error is to simply restart Visual Studio 2022, I feel that something in the Intellisense process was failing out.

I started writing this post in hopes that there would be a more elaborate fix, but a simple restart resolved the issue.

Here is what the resolved .editorconfig file looks like in Visual Studio 2022:

Resolved Editor Config

Backstory - Adding EditorConfig to .NET 6 App in Visual Studio 2022

I was trying to add an editorconfig file to my web application in Visual Studio 2022 using this EditorConfig Guide from Microsoft.

I attempted to add the editorconfig by Right-Clicking on my project in the solution explorer and clicking Add > New Item.

Then I selected editorconfig File (default) and left the file name as .editorconfig and clicked Add: Add Editor Config Visual Studio 2022

When I went to view the newly created .editorconfig file I get this error:

An exception was encountered while constructing the content of this frame.  This information is also logged in "C:\Users\ExampleUser\AppData\Roaming\Microsoft\VisualStudio\17.0_28513113\ActivityLog.xml".

Exception details:
System.ArgumentNullException: Value cannot be null.
Parameter name: path

Here is an image of the error: Editor Config An Exception Was Encountered While Constructing The Content