Skip to content
This repository has been archived by the owner on Oct 29, 2024. It is now read-only.

Unable to load image from URL #464

Open
davidortinau opened this issue Jul 21, 2022 · 1 comment
Open

Unable to load image from URL #464

davidortinau opened this issue Jul 21, 2022 · 1 comment

Comments

@davidortinau
Copy link

<Image Source="https://github.com/davidortinau/davidortinau/blob/da46072934f03036e55c5b4e9bdff8483a1767cd/davidortinau_2019.png"/>

Throws compile error:

/Users/davidortinau/work/mbbstarter/mbbstarter/MainPage.razor(17,34): error CS1525: Invalid expression term ')' [/Users/davidortinau/work/mbbstarter/mbbstarter/mbbstarter.csproj]

@Dreamescaper
Copy link
Contributor

Dreamescaper commented Jul 22, 2022

Seems like a https://github.com/dotnet/razor-compiler bug, probably due to implicit conversion to ImageSource.
Works fine this way:

<Image Source=@("https://raw.githubusercontent.com/davidortinau/davidortinau/da46072934f03036e55c5b4e9bdff8483a1767cd/davidortinau_2019.png") />

Alternatively you can have it as field, it will probably be a bit better from performance perspective:

<Image Source="_image " />

@code {
   ImageSource _image = "https://raw.githubusercontent.com/davidortinau/davidortinau/da46072934f03036e55c5b4e9bdff8483a1767cd/davidortinau_2019.png";
}

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