System.IO.IOException "Function not implemented" in CreateHostBuilder(args).Build().Run()

0

When I start debugging my app in a Linux Docker container, I get the exception when calling CreateHostBuilder(args).Build(). The code is part of a pretty new AspASP.NET Core MVC 3.1 project.

I saw the issue before and maybe fixed it removing an orphan file in a Views sub-folder. The problem seemed to come back after switching branches in git. It happened a third time after renaming a cshtml file in my project.

    public static void Main(string[] args)
    {
        CreateHostBuilder(args).Build().Run();
    }

Exception

System.IO.IOException
  HResult=0x00000026
  Message=Function not implemented
  Source=System.IO.FileSystem
  StackTrace:
   at System.IO.Enumeration.FileSystemEnumerator`1.CreateDirectoryHandle(String path, Boolean ignoreNotFound)
   at System.IO.Enumeration.FileSystemEnumerator`1.Init()
   at System.IO.Enumeration.FileSystemEnumerator`1..ctor(String directory, Boolean isNormalized, EnumerationOptions options)
   at System.IO.Enumeration.FileSystemEnumerable`1..ctor(String directory, FindTransform transform, EnumerationOptions options, Boolean isNormalized)
   at System.IO.Enumeration.FileSystemEnumerableFactory.UserDirectories(String directory, String expression, EnumerationOptions options)
   at System.IO.Directory.InternalEnumeratePaths(String path, String searchPattern, SearchTarget searchTarget, EnumerationOptions options)
   at System.IO.Directory.EnumerateDirectories(String path)
   at System.IO.FileSystemWatcher.RunningInstance.AddDirectoryWatchUnlocked(WatchedDirectory parent, String directoryName)
   at System.IO.FileSystemWatcher.RunningInstance.AddDirectoryWatchUnlocked(WatchedDirectory parent, String directoryName)
   at System.IO.FileSystemWatcher.RunningInstance.AddDirectoryWatchUnlocked(WatchedDirectory parent, String directoryName)
   at System.IO.FileSystemWatcher.RunningInstance.AddDirectoryWatchUnlocked(WatchedDirectory parent, String directoryName)
   at System.IO.FileSystemWatcher.RunningInstance..ctor(FileSystemWatcher watcher, SafeFileHandle inotifyHandle, String directoryPath, Boolean includeSubdirectories, NotifyFilters notifyFilters, CancellationToken cancellationToken)
   at System.IO.FileSystemWatcher.StartRaisingEvents()
   at System.IO.FileSystemWatcher.StartRaisingEventsIfNotDisposed()
   at System.IO.FileSystemWatcher.set_EnableRaisingEvents(Boolean value)
   at Microsoft.Extensions.FileProviders.Physical.PhysicalFilesWatcher.TryEnableFileSystemWatcher()
   at Microsoft.Extensions.FileProviders.Physical.PhysicalFilesWatcher.CreateFileChangeToken(String filter)
   at Microsoft.Extensions.FileProviders.PhysicalFileProvider.Watch(String filter)
   at Microsoft.Extensions.Configuration.FileConfigurationProvider.<.ctor>b__1_0()
   at Microsoft.Extensions.Primitives.ChangeToken.ChangeTokenRegistration`1..ctor(Func`1 changeTokenProducer, Action`1 changeTokenConsumer, TState state)
   at Microsoft.Extensions.Primitives.ChangeToken.OnChange(Func`1 changeTokenProducer, Action changeTokenConsumer)
   at Microsoft.Extensions.Configuration.FileConfigurationProvider..ctor(FileConfigurationSource source)
   at Microsoft.Extensions.Configuration.Json.JsonConfigurationSource.Build(IConfigurationBuilder builder)
   at Microsoft.Extensions.Configuration.ConfigurationBuilder.Build()
   at Microsoft.Extensions.Hosting.HostBuilder.BuildAppConfiguration()
   at Microsoft.Extensions.Hosting.HostBuilder.Build()
   at FieldViewAdminHub.Program.Main(String[] args)

I Tried

  • Executing a Clean
  • Deleting obj and bin folders
  • Stopping the docker container explicitly
asp.net-core-mvc
asked on Stack Overflow Aug 19, 2020 by Andy Joiner • edited Aug 21, 2020 by Andy Joiner

3 Answers

3

Based on the answer by @AnGG, I just restarted Docker for Windows (I did not want to prune right now).

answered on Stack Overflow Aug 19, 2020 by Andy Joiner • edited Aug 21, 2020 by Andy Joiner
1

Try ( be careful with those )

  1. stop all the running containers
  2. docker system prune ( be careful, this may remove all unused containers, networks, images (both dangling and unreferenced), and optionally, volumes. )
  3. docker system prune -a ( be careful, this may remove all unused containers, networks, images (both dangling and unreferenced), and optionally, volumes. )
  4. docker volume prune ( be careful, this may remove all volumes. )
  5. restart docker
  6. docker project clean
  7. delete bin and obj folders inside the project folder
  8. docker project rebuild

try to debug again

answered on Stack Overflow Aug 19, 2020 by AnGG • edited Aug 19, 2020 by AnGG
-1
public static IHostBuilder CreateHostBuilder(string[] args) =>
        Host.CreateDefaultBuilder(args)
            .ConfigureWebHostDefaults(webBuilder =>
            {
                webBuilder.UseStartup<Startup>();
            });


public Startup(IConfiguration configuration)
    {
        _configuration = configuration;
    }

Hi, Please try to add this right after your code. And write the second to Startup. It will be constructor. And one more thing, check your libraries and be sure to have configuration extension. I think your problem is your function don't have a mission. This way you are pathing your startup and having a default host. Basicly. Hope it works. Have a nice day.

answered on Stack Overflow Aug 19, 2020 by hailPersephone

User contributions licensed under CC BY-SA 3.0