Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
rruizGit opened this issue Sep 8, 2023 · 7 comments
Closed

Comments

@rruizGit
Copy link

rruizGit commented Sep 8, 2023

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

@ghost ghost added the untriaged New issue has not been triaged by the area owner label Sep 8, 2023
@ghost
Copy link

ghost commented Sep 8, 2023

Tagging subscribers to this area: @vitek-karas, @agocke, @VSadov
See info in area-owners.md if you want to be subscribed.

Issue Details

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

Author: rruizGit
Assignees: -
Labels:

area-Host

Milestone: -

@vitek-karas
Copy link
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.

@vitek-karas
Copy link
Member

/cc @elinor-fung

@rruizGit
Copy link
Author

rruizGit commented Sep 8, 2023

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.

@agocke
Copy link
Member

agocke commented Sep 11, 2023

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.

@agocke agocke closed this as completed Sep 11, 2023
@ghost ghost removed the untriaged New issue has not been triaged by the area owner label Sep 11, 2023
@rruizGit
Copy link
Author

rruizGit commented Sep 11, 2023

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.

@elinor-fung
Copy link
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.

@ghost ghost locked as resolved and limited conversation to collaborators Oct 18, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants