Skip to content

Empty .Net Core Runtime install folder is enough to break applications. #91806

@rruizGit

Description

@rruizGit

Description

Description:

  • A group of applications are built to run against .Net 6.
  • A tester or user uninstalls the .Net Runtime for whatever reason, in this example assume .Net v6.0.20.
  • Later, when our applications are installed, the .Net 6 Runtime is reinstalled, in this example assume .Net v6.0.16.
  • Our applications fail to execute.
  • Event Viewer shows this error: "Message: A fatal error was encountered. The library 'hostpolicy.dll' required to execute the application was not found in 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\6.0.20'."
  • We then notice that an empty "6.0.20" folder exists while the full Runtime is available in a "6.0.16" folder.
  • If we delete the 6.0.20 the issue is fixed.

Reproduction Steps

We do not know what is causing the empty folder. It is happening to our testers and in the field to Windows users, albeit at a low rate. But when you have millions of customers, it adds up.

We have not been able to reproduce this issue at all when we are actively trying. So we do not know how the issue comes about. But you can manually replicate the problem by simply creating an empty folder in

C:\Program Files\dotnet\shared\Microsoft.NETCore.App\6.0.xx

where xx has to be the highest version installed.

Expected behavior

When faced with an empty .Net Core folder, the application should look for another version of the runtime which meets it's requirements.

Actual behavior

All .Net Core applications targeting the Runtime (major.minor) will fail to execute.

Regression?

This issues exists in all .Net Core versions, I believe.

Known Workarounds

  • Delete the folder, but that is not a solution for the field.
  • Have our installers detect that situation and fix it. Not ideal.

Configuration

  • We are using .Net 6
  • Windows 10 & 11
  • Mostly x64, but we can repro on ARM64
  • Not specific to any version or flavor of Windows

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions