Skip to content

[Bug] System.IO.IOException: The process cannot access the file #8654

Open
@VaclavElias

Description

@VaclavElias

Describe the bug

I run docfx en/docfx.json and get this error below, but it is very rare and random. Maybe worth to log it here. Maybe it happens once per 20-30 runs in my case.

System.IO.IOException: The process cannot access the file 'D:\Projects\GitHub\stride-docs-next\en\_site\api\Valve.VR.PropertyWrite_t.html' because it is being used by another process.
   at Microsoft.Win32.SafeHandles.SafeFileHandle.CreateFile(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options)
   at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize)
   at System.IO.Strategies.OSFileStreamStrategy..ctor(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize)
   at Microsoft.DocAsCode.Common.ManifestFileWriter.Create(RelativePath file) in /_/src/Microsoft.DocAsCode.Common/FileAbstractLayer/ManifestFileWriter.cs:line 65
   at Microsoft.DocAsCode.Plugins.RootedFileAbstractLayer.Create(String file) in /_/src/Microsoft.DocAsCode.Plugins/RootedFileAbstractLayer.cs:line 31
   at Microsoft.DocAsCode.Build.Engine.HtmlPostProcessor.Process(Manifest manifest, String outputFolder) in /_/src/Microsoft.DocAsCode.Build.Engine/PostProcessors/HtmlPostProcessor.cs:line 44
   at Microsoft.DocAsCode.Build.Engine.PostProcessorsHandler.Handle(List`1 postProcessors, Manifest manifest, String outputFolder) in /_/src/Microsoft.DocAsCode.Build.Engine/PostProcessors/PostProcessorsHandler.cs:line 31
   at Microsoft.DocAsCode.Build.Engine.DocumentBuilder.Build(IList`1 parameters, String outputDirectory) in /_/src/Microsoft.DocAsCode.Build.Engine/DocumentBuilder.cs:line 173
   at Microsoft.DocAsCode.SubCommands.DocumentBuilderWrapper.BuildDocument(BuildJsonConfig config, BuildOptions options, TemplateManager templateManager, String baseDirectory, String outputDirectory, String pluginDirectory, String templateDirectory) in /_/src/[Microsoft.DocAsCode.App/Helpers/DocumentBuilderWrapper.cs:line](http://microsoft.docascode.app/Helpers/DocumentBuilderWrapper.cs:line) 47
   at Microsoft.DocAsCode.RunBuild.Exec(BuildJsonConfig config, BuildOptions options, String configDirectory, String outputDirectory) in /_/src/[Microsoft.DocAsCode.App/RunBuild.cs:line](http://microsoft.docascode.app/RunBuild.cs:line) 31

To Reproduce

Just a regular run of docfx build.

Expected behavior

Probably it shouldn't happen. The processes shouldn't be locking the file?

Context (please complete the following information):

  • OS: Windows 11
  • Docfx version: 2.65.3

Another example:

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    static-siteProduce static HTML output ready for publishing to hosts like GitHub pages

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions