Skip to content

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

Closed

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

Activity

  1. ghost added
    untriagedNew issue has not been triaged by the area owner
    on Sep 8, 2023
  2. vitek-karas commented on Sep 8, 2023

    @vitek-karas
    Member

    This should be fixed in #90035.
    I think the fix should be in .NET 8 RC1 when it ships (or you can get the nightly).

    The fix is in hostfxr which is "global" on the machine and we always use the latest version. If you install the fixed version then it will be fixed for all apps regardless of which version of the runtime they need.

  3. vitek-karas commented on Sep 8, 2023

    @vitek-karas
    Member
  4. rruizGit commented on Sep 8, 2023

    @rruizGit
    Author

    Nice to know it was fixed. That said, .Net 6 is an LTS. Therefore, I would like to propose that the fix needs to be backported to .Net 6. I work for Dell Technologies and stating that we need to install the .Net 6 runtime AND the .Net 8 runtime (when released) on all of our customer's machines just to fix this issue seems extreme.

  5. agocke commented on Sep 11, 2023

    @agocke
    Member

    Given that this is not a regression and can only result from an incorrect uninstall, I do not think this meets the bar for backport to .NET 6.

  6. ghost removed
    untriagedNew issue has not been triaged by the area owner
    on Sep 11, 2023
  7. rruizGit commented on Sep 11, 2023

    @rruizGit
    Author

    Interesting decision. .Net 6 is an LTS and we have proof that this issue leaves customer machines unable to execute .Net 6 applications. ANY .Net 6 application.

  8. elinor-fung commented on Sep 18, 2023

    @elinor-fung
    Member

    After some more evaluation of the impact and risk, we are backporting this to .NET 6 (and 7). We missed the deadline for October, but the fix should be in the November release.

  9. ghost locked as resolved and limited conversation to collaborators on Oct 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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