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

WPF content files don't work with single-file #3516

Open
ericstj opened this issue Sep 15, 2020 · 4 comments
Open

WPF content files don't work with single-file #3516

ericstj opened this issue Sep 15, 2020 · 4 comments
Assignees
Labels
Bug Product bug (most likely)
Milestone

Comments

@ericstj
Copy link
Member

ericstj commented Sep 15, 2020

Description

Create a WPF application that uses ContentFiles

When run outside single file this works and can load content.

When run under singlefile this fails because this throws:

entryLocation = new Uri(Application.ResourceAssembly.CodeBase);

Resulting in null return value which later throws here:

Most likely this ContentFilePart needs to "know" about single-file and be able to fetch it's content file.

System.ArgumentNullException: Value cannot be null. (Parameter 'baseUri')
   at System.Uri..ctor(Uri baseUri, String relativeUri)
   at MS.Internal.AppModel.ContentFilePart.GetStreamCore(FileMode mode, FileAccess access)
   at System.IO.Packaging.PackagePart.GetStream(FileMode mode, FileAccess access)
   at MS.Internal.IO.Packaging.PackagePartExtensions.GetSeekableStream(PackagePart packPart, FileMode mode, FileAccess access)
   at MS.Internal.IO.Packaging.PackagePartExtensions.GetSeekableStream(PackagePart packPart)
   at System.Windows.Application.GetContentStream(Uri uriContent)
   at wpf.MainWindow..ctor()

Configuration

net5.0-windows, 5.0.0-rc.2.20464.8, publishSingleFile, win-x64

Regression?

No, single file WPF didn't work until RC2

Other information

Repro:
wpf.zip

To repro run dotnet publish -p:PublishSingleFile=true -r:win-x64 -f:net5.0-windows

Compare execution of normal vs single file app.

@ghost
Copy link

ghost commented Sep 15, 2020

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

@agocke
Copy link
Member

agocke commented Sep 15, 2020

The behavior in single-file publishing looks by-design to me: https://github.com/dotnet/designs/blob/main/accepted/2020/single-file/design.md

I think this issue is more appropriate for the WPF repo

@ericstj ericstj transferred this issue from dotnet/runtime Sep 15, 2020
@Sewer56
Copy link

Sewer56 commented Sep 21, 2020

Regression?

No, single file WPF didn't work until RC2

This is a regression (since Preview 8).

Although single file self-contained WPF applications didn't work until RC2, framework-dependent applications did.
Due to the same issue, framework-dependent applications no longer function at the current moment in time.

@Sewer56
Copy link

Sewer56 commented Aug 1, 2022

Bumping this issue after 2 years as I want to express my continued interest.
The regression is (in the context of framework dependent single file) is still here today and despite the milestone; this issue hasn't been assigned onto any of the repository projects.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Product bug (most likely)
Projects
None yet
Development

No branches or pull requests

4 participants