madskristensen / WorkspaceFiles

Apache License 2.0
32 stars 8 forks source link

Solution Explorer does not load on a vanilla Console App #16

Closed deadlydog closed 9 months ago

deadlydog commented 9 months ago

Describe the bug

When creating a new Console Application, when Visual Studio loads, the Solution Explorer does not load as expected. Instead it shows the following error message.

Failed to create view with exception:
System.NullReferenceException: Object reference not set to an instance of an object.
   at WorkspaceFiles.WorkspaceRootNode.BuildAllDirectories() in D:\a\WorkspaceFiles\WorkspaceFiles\src\MEF\WorkspaceRootNode.cs:line 86
   at WorkspaceFiles.WorkspaceRootNode.get_Items() in D:\a\WorkspaceFiles\WorkspaceFiles\src\MEF\WorkspaceRootNode.cs:line 75
   at Microsoft.VisualStudio.PlatformUI.AggregateAttachedCollectionSource.InitializeItemCollection()
   at Microsoft.VisualStudio.PlatformUI.AggregateAttachedCollectionSource.get_InnerItems()
   at Microsoft.VisualStudio.PlatformUI.SolutionNavigatorPane.HookShowSolutionNodeEvents(IVsHierarchyItem solution)
   at Microsoft.VisualStudio.PlatformUI.SolutionNavigatorPane.RefillNavigator(Boolean skipRestorePhase, Boolean isFirstLoad)

To Reproduce Steps to reproduce the behavior:

  1. Open Visual Studio 2022
  2. At the welcome splash screen, choose Create a new project.
  3. Select Console App (C#) and hit the Next button.
  4. Leave the default project name ConsoleApp1 and use whatever Location you like. e.g. I used C:\Users\Dan.Schroeder\Desktop\Temp. Hit the Next button.
  5. Use the `.NET 8.0 (Long Term Support) Framework.
  6. Hit the Create button.
  7. When Visual Studio loads with the new project, the Solution Explorer shows an error message instead of the solution tree.

If I close Visual Studio and re-open the solution, the problem persists. If I disable the File Explorer extension and restart Visual Studio, then the Solution Explorer loads as expected.

Expected behavior

The solution explorer should load as expected.

Screenshots

Here is a screenshot of the error message: image

Here is a gif of creating a new vanilla Console App and reproducing the issue: Visual Studio Workspace Files extension crash

Additional context

File Explorer extension version 1.0.43

Visual Studio information:

Microsoft Visual Studio Enterprise 2022
Version 17.8.5
VisualStudio.17.Release/17.8.5+34511.84
Microsoft .NET Framework
Version 4.8.04084

Installed Version: Enterprise

Visual C++ 2022   00476-80000-00000-AA452
Microsoft Visual C++ 2022

ADL Tools Service Provider   1.0
This package contains services used by Data Lake tools

ASA Service Provider   1.0

ASP.NET and Web Tools   17.8.358.6298
ASP.NET and Web Tools

Azure App Service Tools v3.0.0   17.8.358.6298
Azure App Service Tools v3.0.0

Azure Data Lake Tools for Visual Studio   2.6.5000.0
Microsoft Azure Data Lake Tools for Visual Studio

Azure Functions and Web Jobs Tools   17.8.358.6298
Azure Functions and Web Jobs Tools

Azure Stream Analytics Tools for Visual Studio   2.6.5000.0
Microsoft Azure Stream Analytics Tools for Visual Studio

BlazmExtension   1.7.8
Extension that helps you with common Blazor tasks like creating a Isolated CSS or JavaScript from a context menu item

C# Tools   4.8.0-7.23572.1+7b75981cf3bd520b86ec4ed00ec156c8bc48e4eb
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Color Preview   1.0.27
Shows a color preview in front of all named colors, hex, rgb and hsl values in CSS files.

Common Azure Tools   1.10
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

Extensibility Message Bus   1.4.39 (main@e8108eb)
Provides common messaging-based MEF services for loosely coupled Visual Studio extension components communication and integration.

File Explorer   1.0.43
Gives access to all files and folders from the file system under the repo- or solution root folder. All in the same Solution Explorer view.

File Icons   2.7
Adds icons for files that are not recognized by Solution Explorer

GitHub Copilot   1.155.0.0 (v1.155.0.0@1564940eb)
GitHub Copilot is an AI pair programmer that helps you write code faster and with less work.

GitHub Copilot Agent   1.155.0

ILSpy.AddIn   1.0
Integration of the ILSpy Decompiler into Visual Studio.

Microsoft Azure Hive Query Language Service   2.6.5000.0
Language service for Hive query

Microsoft Azure Stream Analytics Language Service   2.6.5000.0
Language service for Azure Stream Analytics

Microsoft Azure Tools for Visual Studio   2.9
Support for Azure Cloud Services projects

Microsoft JVM Debugger   1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines

Mono Debugging for Visual Studio   17.8.17 (957fbed)
Support for debugging Mono processes with Visual Studio.

NuGet Package Manager   6.8.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/

PowerShell Pro Tools for Visual Studio   1.0
A set of tools for developing and debugging PowerShell scripts and modules in Visual Studio.

Razor (ASP.NET Core)   17.8.3.2405201+d135dd8d2ec1c2fbdee220e8656b308694e17a4b
Provides languages services for ASP.NET Core Razor.

SQL Server Data Tools   17.8.120.1
Microsoft SQL Server Data Tools

ToolWindowHostedEditor   1.0
Hosting json editor into a tool window

Tweaks 2022   1.1.143
A collection of minor fixes and tweaks for Visual Studio to reduce the paper cuts and make you a happier developer

TypeScript Tools   17.0.20920.2001
TypeScript Tools for Microsoft Visual Studio

Visual Basic Tools   4.8.0-7.23572.1+7b75981cf3bd520b86ec4ed00ec156c8bc48e4eb
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Visual F# Tools   17.8.0-beta.23475.2+10f956e631a1efc0f7f5e49c626c494cd32b1f50
Microsoft Visual F# Tools

Visual Studio IntelliCode   2.2
AI-assisted development for Visual Studio.

Visual Studio Tools for Unity   17.8.2.0
Visual Studio Tools for Unity

VisualStudio.DeviceLog   1.0
Information about my package

VisualStudio.Mac   1.0
Mac Extension for Visual Studio

Xamarin   17.8.0.157 (d17-8@8e82278)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin Designer   17.8.3.6 (remotes/origin/d17-8@eccf46a291)
Visual Studio extension to enable Xamarin Designer tools in Visual Studio.

Xamarin Templates   17.8.16 (830b56a)
Templates for building iOS, Android, and Windows apps with Xamarin and Xamarin.Forms.

Xamarin.Android SDK   13.2.2.0 (d17-5/45b0e14)
Xamarin.Android Reference Assemblies and MSBuild support.
    Mono: d9a6e87
    Java.Interop: xamarin/java.interop/d17-5@149d70fe
    SQLite: xamarin/sqlite/3.40.1@68c69d8
    Xamarin.Android Tools: xamarin/xamarin-android-tools/d17-5@ca1552d

Xamarin.iOS and Xamarin.Mac SDK   16.4.0.23 (9defd91b3)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.
madskristensen commented 9 months ago

This should be fixed with the latest commit. New version being released by CI in a few minutes