Skip to content

SingleFile app fails after failed extraction #1255

@jls5177

Description

@jls5177

Problem: I have a dotnet core 3 app that is published as a SingleFile which is run concurrently as part of our continuous build/test platform. About once a day one of the build nodes fails to find one of the assemblies. At this point all successive runs of the app fail with the same error.

C:\>C:\dotnet\bin\Release\netcoreapp3.1\win-x64\publish\dotnet.exe
Error:
  An assembly specified in the application dependencies manifest (dotnet.deps.json) was not found:
    package: 'runtimepack.Microsoft.NETCore.App.Runtime.win-x64', version: '3.1.0'
    path: 'Microsoft.VisualBasic.dll'

There are 2 issues here:

  1. Concurrent extracts cause some files to be missing from the extraction directory. Possible due to the directory rename step?

  2. Subsequent runs after a failed extraction do not correct the missing assemblies.

The first issue might be harder to chase down as this is a race condition. In addition, fixing the second issue would at least minimize the exposure to a single run. I provide reproduction steps for the second issue below.

Expected Results: The app should recover from a failed extraction on the next run. Re-extracting any missing assemblies from the binary.

Workaround: I can recover the build node by deleting the extraction directory which forces the app to extract again on the next run.

Reproduction Steps: I am able to recreate the failure by performing the following steps:

  1. Build a new console app and publishing it as a SingleFile
C:\dotnet>dotnet new console

Welcome to .NET Core 3.1!
---------------------
SDK Version: 3.1.100

Getting ready...
The template "Console Application" was created successfully.

Processing post-creation actions...
Running 'dotnet restore' on C:\dotnet\dotnet.csproj...
  Restore completed in 184.05 ms for C:\dotnet\dotnet.csproj.

Restore succeeded.

C:\dotnet>dotnet publish -r win-x64 -c Release /p:PublishSingleFile=true
Microsoft (R) Build Engine version 16.4.0+e901037fe for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

  Restore completed in 9.74 sec for C:\dotnet\dotnet.csproj.
  dotnet -> C:\dotnet\bin\Release\netcoreapp3.1\win-x64\dotnet.dll
  dotnet -> C:\dotnet\bin\Release\netcoreapp3.1\win-x64\publish\
  1. Running the app one time to extract the contents
  2. Delete any of the assemblies in the extracted directory. Need to leave the directory otherwise the app will be extracted again
  3. Run the app again to see the failure listed above

Comments

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions