Skip to content

Application.GetContentStream() may fail if the app is in a path that contains a "#". #4781

Closed
@neelabo

Description

@neelabo
  • .NET Core Version: .NET 5.0
  • Windows version: 21H1
  • Does the bug reproduce also in WPF for .NET Framework 4.8?: Yes

Problem description:

Application.GetContentStream() will fail if you place the executable in a path that contains "#".
Apparently, the paths after the "#" have disappeared.

Minimal repro:

For example, if you place the executable file and content file in "C:\FooBar\Path#Name\",
you will get the exception FileNotFoundException: Could not find file 'C:\FooBar\test.png'..

var uri = new Uri("/test.png", UriKind.Relative); // test.png is content file
var streamResourceInfo = Application.GetContentStream(uri); // <- Exception!!

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions