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

Some file is missing from single-file self-contained publish beginning in .NET 5.0.3 #4609

Closed
gcaughey opened this issue Feb 25, 2021 · 8 comments

Comments

@gcaughey
Copy link

  • .NET Core Version: 5.0.3
  • Have you experienced this same bug with .NET Framework?: No

Problem description:

Application fails to launch with this message: Launch exception: The system cannot find the file specified. (0x80070002)
This only happens with a a single-file self-contained app published to a folder on a PC that doesn't have .NET 5 runtime installed.
If the app is published self-contained but not single-file, the app runs as expected.

This appears to only happen in a winforms app. I have not seen this behavior in WPF apps.

Expected behavior: It should run when published single-file self-contained as it did with previous versions of .NET 5, which did not have this issue,

Minimal repro:

@RussKie
Copy link
Member

RussKie commented Feb 25, 2021

This sounds like a duplicate of #4397 (which is a duplicate of dotnet/runtime#40103).
Please have a look in it to see if it is.

Please check EventViewer for stack traces and other relevant information for more insights.

@gcaughey
Copy link
Author

There is nothing in EventViewer. I can't say for sure if this is the same issue, but even if not, it could have a common cause.

@gcaughey
Copy link
Author

This behavior is new for me beginning in .NET 5.0.3, so that would be different from those other issues, which occurred in earlier versions of NET 5.

@RussKie
Copy link
Member

RussKie commented Feb 25, 2021

Can you please provide a small repro so we can investigate further?

@RussKie RussKie added the waiting-author-feedback The team requires more information from the author label Feb 25, 2021
@gcaughey
Copy link
Author

I'm still working on a small repro, but I was able to get something from the EventViewer with a different app that also fails to launch:

Faulting application name: WasteworksSyncManager.exe, version: 2.0.0.0, time stamp: 0x600b9ea2
Faulting module name: KERNELBASE.dll, version: 10.0.18362.1316, time stamp: 0x7a6bfa05
Exception code: 0xe0434352
Fault offset: 0x001146d2
Faulting process id: 0x57d4
Faulting application start time: 0x01d70c4982551974
Faulting application path: C:\ProgramData\WasteWORKS-SQL\WWSync\WasteworksSyncManager.exe
Faulting module path: C:\WINDOWS\System32\KERNELBASE.dll
Report Id: 9a41ca88-60d0-4108-a758-47ad99da08ef
Faulting package full name:
Faulting package-relative application ID:

Application: WasteworksSyncManager.exe
CoreCLR Version: 5.0.321.7212
.NET Version: 5.0.3
Description: The process was terminated due to an unhandled exception.
Exception Info: System.IO.FileNotFoundException: The system cannot find the file specified. (0x80070002)
at System.Reflection.RuntimeModule.GetFullyQualifiedName()
at System.Reflection.RuntimeModule.get_Name()
at System.Windows.Forms.Application.EnableVisualStyles()
at WasteWorks.Program.Main(String[] args)

@ghost ghost removed the waiting-author-feedback The team requires more information from the author label Feb 26, 2021
@gcaughey
Copy link
Author

TestWinformsPublish.zip

Repro steps:

  1. File, new Winforms project targeting .NET 5
  2. Build
  3. Publish to folder selecting Release/x86 single-file self-contained
  4. Try to run from a PC that doesn't have .NET 5 installed
  5. Check EventViewer for errors. I got this:

Application: TestWinformsPublish.exe
CoreCLR Version: 5.0.321.7212
.NET Version: 5.0.3
Description: The process was terminated due to an unhandled exception.
Exception Info: System.IO.FileNotFoundException: The system cannot find the file specified. (0x80070002)
at System.Reflection.RuntimeModule.GetFullyQualifiedName()
at System.Reflection.RuntimeModule.get_Name()
at System.Windows.Forms.Application.EnableVisualStyles()
at TestWinformsPublish.Program.Main()

Faulting application name: TestWinformsPublish.exe, version: 1.0.0.0, time stamp: 0x600b9ea2
Faulting module name: KERNELBASE.dll, version: 10.0.21322.1000, time stamp: 0x7cfb5e08
Exception code: 0xe0434352
Fault offset: 0x0013a212
Faulting process id: 0x1a38
Faulting application start time: 0x01d70c5159c87272
Faulting application path: Z:\TestPublish\TestWinformsPublish.exe
Faulting module path: C:\WINDOWS\System32\KERNELBASE.dll
Report Id: bace5034-309a-48cc-8fc0-6e491f83d188
Faulting package full name:
Faulting package-relative application ID:

@gcaughey
Copy link
Author

I found that if I commented out this line in program.cs, the app loads ok:
//Application.EnableVisualStyles();

@RussKie
Copy link
Member

RussKie commented Mar 1, 2021

Duplicate of #4397

@RussKie RussKie marked this as a duplicate of #4397 Mar 1, 2021
@RussKie RussKie closed this as completed Mar 1, 2021
@ghost ghost locked as resolved and limited conversation to collaborators Jan 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants