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

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 join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants