question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Image Source fails to load an image if application path has hash sign in it

See original GitHub issue
  • .NET Core Version: 6.0.4
  • Windows version: Windows 11 21H2
  • Does the bug reproduce also in WPF for .NET Framework 4.8?: Yes

Problem description: It is possible to specify Image source with relative path in XAML definition: Icon="Images/app.dark.png" However, this definition fails to load image if the path containing application has # symbol.

Actual behavior: In .Net 6 Fails in BitmapDecoder.SetupDecoderFromUriOrStream with System.IO.DirectoryNotFoundException which transforms to exception going out: System.Windows.Markup.XamlParseException: "System.Windows.Baml2006.TypeConverterMarkupExtension" throws an exception."

Expected behavior: We should load image with relative path without crash.

Minimal repro:

  1. Create a WPF application
  2. Add image in subfolder and specify its Build Action as Content and Copy to Output Directory as Copy or Copy if newer
  3. Specify main window Icon image with relative path <Window x:Class="WpfApp1.MainWindow" Icon="Images/app.dark.png">
  4. Start an application and check everything is okay
  5. Rename the project path into #WpfApp1
  6. Start an application
  7. Get an exception shown above

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:1
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
lindexicommented, May 11, 2022
1reaction
dipeshmsftcommented, May 18, 2022

Yeah, as @lindexi mentioned this is a duplicate of #4781, hence we are marking it closed as of now and will keep tracking the bug from the original issue. Also, we will take a look at the PR #5066 from @lindexi, to get to a resolution.

Read more comments on GitHub >

github_iconTop Results From Across the Web

HTML <img src> wont load my images
Try to work with the full path as: <img src="http://www.yourdomain.com/images/me.jpg" width="200" height="267" alt="me">.
Read more >
<img>: The Image Embed element - HTML - MDN Web Docs
The above example shows usage of the <img> element: The src attribute is required, and contains the path to the image you want...
Read more >
Components: <Image>
A loader is a function returning a URL string for the image, given the following parameters: src; width; quality. Here is an example...
Read more >
Lazy Loading Images – The Complete Guide
Everything about Image Lazy loading - what is it, why is it important, how to implement lazy loading of images and the best...
Read more >
Image - Expo Documentation
A cross-platform and performant React component that loads and renders images.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found