luberda-molinet / FFImageLoading

Image loading, caching & transforming library for Xamarin and Windows
MIT License
1.42k stars 377 forks source link

UWP release mode #759

Closed bprochniak closed 6 years ago

bprochniak commented 7 years ago

No image is dispaly in UWP in Release mode:

<ffimageloading:CachedImage x:Name="previewImage" DownsampleToViewSize="true" LoadingPlaceholder="loading.svg" ErrorPlaceholder="loading.svg" 
                                        HorizontalOptions="CenterAndExpand" Source="{ Binding GalleryManager.Preview.ProfileImageUrl }" 
                                        Transformations="{ Binding GalleryManager.Preview.Rotation, Converter={x:Static local:RotateToTransformationConverter.Instance}}"
                                        Aspect="AspectFit" Grid.Row="0" />     

when I remove this line:

Transformations="{ Binding GalleryManager.Preview.Rotation, Converter={x:Static local:RotateToTransformationConverter.Instance}}"

it is working fine. It is working fine also in Debug mode with this line. I my App.xaml.cs I have:

var assembliesToInclude = new List<Assembly>()
                {
                    typeof(CachedImage).GetTypeInfo().Assembly,
                    typeof(CachedImageRenderer).GetTypeInfo().Assembly,
                    typeof(FFImageLoading.Transformations.RotateTransformation).GetTypeInfo().Assembly
                };

                Xamarin.Forms.Forms.Init(e, assembliesToInclude);

What else I need to do to make it work? Version 2.2.20

daniel-luberda commented 7 years ago

@bprochniak Many people have problems with this. Is it possible to have a reproduction project? I currently don't know why is it happening. Does anyone knows what's the cause?

daniel-luberda commented 7 years ago

This may be related to: https://github.com/luberda-molinet/FFImageLoading/issues/762

Aquastorm commented 7 years ago

@daniel-luberda Hello Daniel, I think this issue is related to #508 and that the cause is a regression in the ImageExtension.cs file. The commit 80764a1 (28 August 2017, title "Some refactorings") re-introduced the problem that was fixed by #508.

bprochniak commented 7 years ago

I have not gone deep into this but I guess this issue occurs because a platform specific transformation dll is not included. The point is, how can I do it?

With FFImageLoading.Forms it is easy. We have the pcl dll FFImageLoading.Forms.dll and the uwp dll FFImageLoading.Forms.WinUWP.dll. The first one I include by typeof(CachedImage).GetTypeInfo().Assembly and secend one by typeof(CachedImageRenderer).GetTypeInfo().Assembly. But there is no FFImageLoading.Transformations.WinUWP.dll file. There is only FFImageLoading.Transformations.dll file and the platform specific dll has the same name and the same namespace in it. So by typeof(FFImageLoading.Transformations.RotateTransformation).GetTypeInfo().Assembly I include only the pcl library and I guess in addition I need to do something like this:

typeof(RotateTransformationRenderer).GetTypeInfo().Assembly or typeof(FFImageLoading.Transformations.WinUWP.RotateTransformation).GetTypeInfo().Assembly

but I can't find this type / namespace.

daniel-luberda commented 6 years ago

The commit 80764a1 (28 August 2017, title "Some refactorings") re-introduced the problem that was fixed by #508.

@Aquastorm Nice catch! I applied a better fix now (IMainThreadDispatcher was faulty when using async methods with it) as it was the main issue.

About Transformations. I think the problem is with Transformation package nuspec file, but I don't know what exactly.

Please check newest 2.2.21 prerelease nuget.

bprochniak commented 6 years ago

It is working fine with 2.2.21-pre576. Thanks.

DVDPT commented 6 years ago

Also confirm that everything works fine, just in time for the release XD. Big thanks

Aquastorm commented 6 years ago

@daniel-luberda Thanks Daniel :) I can also confirm that everything works like a charm with the 2.2.2.1-pre-576 release. We are so happy that we can make a new release for Windows. Thank you Daniel for the fix!