roslyn: System.ArgumentNullException while opening .editorconfig file

This issue has been moved from a ticket on Developer Community.


[severity:It bothers me. A fix would be nice] When trying to open a .editorconfig file in one of my projects, I received a System.ArgumentNullException exception:

An error occurred while initializing the frame's content
System.ArgumentNullException: Value cannot be null.
Parameter name: path
   at System.IO.DirectoryInfo.. ctor(String path)
   at Microsoft.CodeAnalysis.Editor.EditorConfigSettings.Extensions.SolutionExtensions.<>c.<GetProjectsForPath>b__0_1(Project p)
   at System.Linq.Enumerable.<>c__DisplayClass7_0`3. <CombineSelectors>b__0(TSource x)
   at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
   at Microsoft.CodeAnalysis.Editor.EditorConfigSettings.Extensions.SolutionExtensions.GetProjectsForPath(Solution solution, String givenPath)
   at Microsoft.CodeAnalysis.Editor.EditorConfigSettings.DataProvider.SettingsProviderBase`4.Update()
   at Microsoft.CodeAnalysis.Editor.EditorConfigSettings.DataProvider.Formatting.CommonFormattingSettingsProviderFactory.GetForFile(String filePath)
   at Microsoft.CodeAnalysis.Editor.EditorConfigSettings.DataProvider.CombinedOptionsProviderFactory`1.GetForFile(String filePath)
   at Microsoft.CodeAnalysis.Editor.EditorConfigSettings.SettingsAggregator.GetSettingsProvider[TData](String fileName)
   at Microsoft.VisualStudio.LanguageServices.EditorConfigSettings.SettingsEditorPane. <Initialize>g__GetFormattingView|12_0()
   at Microsoft.VisualStudio.LanguageServices.EditorConfigSettings.SettingsEditorPane.Initialize()
   at Microsoft.VisualStudio.Shell.WindowPane.InternalSetSite(IServiceProvider p)
   at Microsoft.VisualStudio.Shell.WindowPane.Microsoft.VisualStudio.Shell.Interop.IVsWindowPane.SetSite(IServiceProvider psp)
   at Microsoft.VisualStudio.Shell.WindowPane.Microsoft.VisualStudio.Shell.Interop.IVsUIElementPane.SetUIElementSite(IServiceProvider p)
   at Microsoft.VisualStudio.Platform.WindowManagement.UIElementDocumentObject.SetSite(DocumentObjectSite site)
   at Microsoft.VisualStudio.Platform.WindowManagement.DocumentObjectSite.InitializeDocumentObject(Object punkView)
   at Microsoft.VisualStudio.Platform.WindowManagement.WindowFrame.InitializeDocumentSite(Boolean creatingStubFrame, Boolean replacingStubView, Object punkView, Object punkData, IServiceProvider pServiceProvider, IVsUIHierarchy pUIHierarchy, UInt32 vsid)
   at Microsoft.VisualStudio.Platform.WindowManagement.WindowManagerService.CreateContentPane(FrameMoniker frameMoniker, Boolean isDocument, String lpstrMkDoc, UInt32 eCreateWindowFlags, Object punkView, Object punkData, IServiceProvider pServiceProvider, IVsUIHierarchy pUIHierarchy, UInt32 vsid, Guid rguidCmdUI, ViewGroup parent, IVsWindowFrame& ppWindowFrame)


Original Comments

Feedback Bot on 5/28/2021, 04:05 AM:

We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.

Feedback Bot on 5/28/2021, 10:38 PM:

Thank you for sharing your feedback! Our teams prioritize action on product issues with broad customer impact. See details at: https://docs.microsoft.com/en-us/visualstudio/ide/report-a-problem?view=vs-2019#faq. In case you need answers to common questions or need assisted support, be sure to use https://visualstudio.microsoft.com/vs/support/. We’ll keep you posted on any updates to this feedback.


Original Solutions

(no solutions)

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 3
  • Comments: 15 (5 by maintainers)

Most upvoted comments

Latest stable: 17.0.4 Microsoft Visual Studio Community 2022 (64-bit)

An error occurred while initializing the frame's content
System.ArgumentNullException: Value cannot be null.
Parameter name: path
   at System.IO.DirectoryInfo..ctor(String path)
   at Microsoft.CodeAnalysis.Editor.EditorConfigSettings.Extensions.SolutionExtensions.<>c.<GetProjectsForPath>b__0_1(Project p)
   at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
   at Microsoft.CodeAnalysis.Editor.EditorConfigSettings.Extensions.SolutionExtensions.GetProjectsForPath(Solution solution, String givenPath)
   at Microsoft.CodeAnalysis.Editor.EditorConfigSettings.DataProvider.SettingsProviderBase`4.Update()
   at Microsoft.CodeAnalysis.Editor.EditorConfigSettings.DataProvider.Whitespace.CommonWhitespaceSettingsProviderFactory.GetForFile(String filePath)
   at Microsoft.CodeAnalysis.Editor.EditorConfigSettings.DataProvider.CombinedOptionsProviderFactory`1.GetForFile(String filePath)
   at Microsoft.CodeAnalysis.Editor.EditorConfigSettings.SettingsAggregator.GetSettingsProvider[TData](String fileName)
   at Microsoft.VisualStudio.LanguageServices.EditorConfigSettings.SettingsEditorPane.<>c__DisplayClass12_0.<Initialize>g__GetWhitespaceView|1()
   at Microsoft.VisualStudio.LanguageServices.EditorConfigSettings.SettingsEditorPane.Initialize()
   at Microsoft.VisualStudio.Shell.WindowPane.InternalSetSite(IServiceProvider p)
   at Microsoft.VisualStudio.Platform.WindowManagement.UIElementDocumentObject.SetSite(DocumentObjectSite site)
   at Microsoft.VisualStudio.Platform.WindowManagement.DocumentObjectSite.InitializeDocumentObject(Object punkView)
   at Microsoft.VisualStudio.Platform.WindowManagement.WindowFrame.InitializeDocumentSite(Boolean creatingStubFrame, Boolean replacingStubView, Object punkView, Object punkData, IServiceProvider pServiceProvider, IVsUIHierarchy pUIHierarchy, UInt32 vsid)
   at Microsoft.VisualStudio.Platform.WindowManagement.WindowManagerService.CreateContentPane(FrameMoniker frameMoniker, Boolean isDocument, String lpstrMkDoc, UInt32 eCreateWindowFlags, Object punkView, Object punkData, IServiceProvider pServiceProvider, IVsUIHierarchy pUIHierarchy, UInt32 vsid, Guid rguidCmdUI, ViewGroup parent, IVsWindowFrame& ppWindowFrame)

Solution is in: C:\Projects\syska\project

It’s in a solutuin folder called: .rules

The file is located here: C:\Projects\syska\project\src\.editorconfig

Taking a look the fix for this is in 17.1 which has not been released yet. You can install the preview to get it early

why this is closed without solution, I have the same issue with 17.0.4