VS2019 showing phantom folders and files named "**" which I cannot find or remove from system

267 views Asked by At

My VS2019 solution, with a WPF project, has started showing a phantom folder named "**", with the following tree of files within:

 - **
    - *
    - *.cs
        - *.resx
    - *.xaml

And because these files are named with illegal syntax, VS gives an error: System.ArgumentException: Illegal characters in path, and the rest of my directories/files are now marked as Excluded, presumably because it can't read past these phantom illegally named files.

The project I'm working on does a hefty amount of file handling and unzipping of rar, zip and 7z files using SharpCompress, so there's a chance I'm accidentally creating a blank or "**" directory and it's making a mess of things somewhere, but it's still bizarre because I can't even delete these things now that they exist.

The files exist at the root of the solution, and ONLY in the solution explorer window of Visual Studio. I can't see them in Windows File Explorer, CMD or Powershell. I can't see them in csproj... I can't see them anywhere.

Fixes I've tried:

  • Restart Visual Studio
  • Delete bin/obj folders
  • Delete csproj.user file
  • Delete .vs folder
  • Rename the phantom files (if I do this, I'm given a second phantom file with the name I chose, and the "**" named file remains)
  • Searched for "**" in whole solution (found nothing)

At the moment I can only surmise that my project is haunted.

The full VS error for the illegal characters in path is:

=====================
06/12/2020 23:17:16
Recoverable
System.ArgumentException: Illegal characters in path.
   at System.Security.Permissions.FileIOPermission.EmulateFileIOPermissionChecks(String fullPath)
   at System.Security.Permissions.FileIOPermission.QuickDemand(FileIOPermissionAccess access, String fullPath, Boolean checkForDuplicates, Boolean needFullPath)
   at Microsoft.VisualStudio.PlatformUI.Packages.FileChange.DefaultFileSystem.PathWrapper.GetFullPath(String path)
   at Microsoft.VisualStudio.Services.FileChangeService.ValidateAndNormalize(String path, String paramName)
   at Microsoft.VisualStudio.Services.FileChangeService.AdviseFileChangeCore(String filename, _VSFILECHANGEFLAGS filter, EventSinkBundle bundle, CancellationToken token)
   at Microsoft.VisualStudio.Services.FileChangeService.<>c__DisplayClass89_0.<AdviseFileChangeAsync>b__0(CancellationToken token)
   at Microsoft.VisualStudio.Services.FileChangeService.<RunWithTracingAsync>d__125`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.ProjectSystem.VS.Implementation.ProjectEvaluationAdditionalDependentFileWatchingService.<CheckContentIrrelevantFileDependenciesStateAsync>d__22.MoveNext()
===================
1

There are 1 answers

0
James On

Remove spaces and any other special characters in your paths, then remove all temp visual studio files and build output files.