Windowscommunitytoolkit: ImageEx not working if IsCacheEnabled is set to true after v1.1.0 update

Created on 30 Oct 2016  路  35Comments  路  Source: windows-toolkit/WindowsCommunityToolkit

I updated to v1.1.0 from v1.0.0 and since then the ImageEx control is only showing the placeholder image. I switched back to v1.0.0 and everything started working fine. I even tried it on a new solution just to confirm and even with the new solution, the ImageEx control only shows the image if IsCacheEnabled is set to false.

bug controls

All 35 comments

This sounds like a bug that @hermitdave fixed for 1.2

can you try with the pre-release nuget?
https://dotnet.myget.org/F/uwpcommunitytoolkit/api/v3/index.json

I am not able to install 1.2 pre-release

Gives me this error on PM console:
Install-Package : Unable to resolve Microsoft.Toolkit.Uwp.UI.Controls (>= 1.2.0-dev00209) for UAP,Version=v10.0.
At line:1 char:1

  • Install-Package Microsoft.Toolkit.Uwp.UI.Controls -Version 1.2.0-dev0 ...
  • ~~~~~~~~~~~~~~~~~

    • CategoryInfo : NotSpecified: (:) [Install-Package], Exception

    • FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand


At line:1 char:1

  • Install-Package Microsoft.Toolkit.Uwp.UI.Controls -Version 1.2.0-dev0 ...
  • ~~~~~~~~~~~~~~~~~

    • CategoryInfo : NotSpecified: (:) [Install-Package], Exception

    • FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand

ping @PedroLamas and @onovotny

Is the MyGet feed configured in a NuGet.config alongside the solution?

Everything looks normal here:
https://dotnet.myget.org/gallery/uwpcommunitytoolkit

I added the myget feed now, but I am getting this:
Install-Package : Failed to retrieve information from remote source 'https://dotnet.myget.org/gallery/uwpcommunitytoolkit/FindPackagesById()?id='Microsoft.Toolkit.Uwp.UI.Controls''.
Response status code does not indicate success: 404 (Not Found).
At line:1 char:1

  • Install-Package Microsoft.Toolkit.Uwp.UI.Controls -Version 1.2.0-dev0 ...
  • ~~~~~~~~~~~~~~~~~

    • CategoryInfo : NotSpecified: (:) [Install-Package], Exception

    • FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand

Install-Package : Failed to retrieve information from remote source 'https://dotnet.myget.org/gallery/uwpcommunitytoolkit/FindPackagesById()?id='Microsoft.Toolkit.Uwp.UI.Controls''.
At line:1 char:1

  • Install-Package Microsoft.Toolkit.Uwp.UI.Controls -Version 1.2.0-dev0 ...
  • ~~~~~~~~~~~~~~~~~

    • CategoryInfo : NotSpecified: (:) [Install-Package], Exception

    • FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand

I think I need to set up the credentials as well.
Is there any way of installing the 1.2 pre-release without creating myget account?

Totally innocent question but shouldn't we have pre release builds available on nuget itself?

We are shipping every one or two months so I think think it is pretty fast for a slow ring :)
For a fast ring we provide the myget version
Perhaps we could introduce an intermediate one as prerelease on nuget?
Not convinced of the value added tbh

I'm not sure either.. Just meant if toy do it on myget why not nuget..

NuGet isn't intended for CI builds. There's no need for credentials to use a MyGet feed, you just need a proper NuGet.config file along your solution.

For example, something like this:
https://github.com/Reactive-Extensions/Rx.NET/blob/master/NuGet.Config#L5

Finally got the 1.2 pre-release insalled. Thanks everyone for helping me out with it.

But the ImageEx control still does not work.
It gives this message "The filename, directory name, or volume label syntax is incorrect." in ImageFailed event.

Give me a few mins I'll have a go

Can your provide a repro case?

I can't reproduce this issue.. I have added references to the pre-release version from myget and no issues here.. repro would be nice

I created a solution with just this control in the MainPage

<toolkit:ImageEx x:Name="TestImage" IsCacheEnabled="True"
                             Source="https://www.nasa.gov/sites/default/files/styles/image_card_4x3_ratio/public/thumbnails/image/leisa_christmas_false_color.png?itok=Jxf0IlS4" 
                             Stretch="UniformToFill"
                             PlaceholderStretch="UniformToFill"  
                             HorizontalAlignment="Center" VerticalAlignment="Center" ImageExFailed="TestImage_ImageExFailed"/>

Please share the project in a zip file

I just changed the image source to https://www.google.co.in/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png and it shows it properly.

Is it because of the image size?

If the website has done internal redirection that might be the cause

Here is the project zip
UWPToolkitSample.zip

But everything works fine when I switch to 1.0.0

Here is the reason.

In v1.0 of the toolkit, the name was dynamically generated from the url using compute hash and saved.

In 1.1, the name is retrieved from Uri. Passing query string results in invalid filename error.

Let me think of ways to handle this.

Hermit

Oh okay. So that is why it is causing this issue. The project I am working on needs to have query string parameter to handle image quality.

okay give me a few hours to think of a workaround to be able to do both

@hermitdave can you remind me why we removed the hash?

@deltakosh firstly we were hardcoding the file extension to .png if I remember correctly.

Me in my great wisdom decided that it wasn't right approach :(

perhaps we can reintroduce it ;)

perhaps.. we don't need a file extension after all

@deltakosh @UwpDev let me reintroduce the hash based filename tomorrow and then I will push a fix out

Yep agree keep the hash w/o the extension

@UwpDev I have pushed a change.. hopefully once it is approved, it should be available on myget and v1.2 release.. my bad

Latest version on myget fixes the issue and we should be good once 1.2 is released on nuget.

Closing this issue now

@hermitdave The blank image bug is fixed but it fails to load from the cache when there is no internet connectivity.

The app just shows placeholders instead of the image even if the image was cached earlier.

okay knew it was too easy.. let me look into it further

@UwpDev I have fixed that issue. Somewhere along the line the actual cached file was not being read. Let me know if you still see any issues

@hermitdave It is working great now. Good job 馃憤

Was this page helpful?
0 / 5 - 0 ratings