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

SvgCachedImage does it work? #49

Closed
EmilAlipiev opened this issue Jan 3, 2020 · 23 comments
Closed

SvgCachedImage does it work? #49

EmilAlipiev opened this issue Jan 3, 2020 · 23 comments

Comments

@EmilAlipiev
Copy link

I followed the docu and it claims that svg support is working for Tizen,
But i cant make it work it. I tried using embedded image and under res folder as below but doesnt work at all for me. I am on tizen 4.0.

I added line

var app = new Program();
Forms.Init(app);
// Initialize FFImageLoading with FormsApplication object
FFImageLoading.Forms.Platform.CachedImageRenderer.Init(app);
 <ffimageloadingsvg:SvgCachedImage HorizontalOptions="EndAndExpand"
                                                             HeightRequest="24" WidthRequest="24"                                                            
                                                              Source="heart.svg" />
              <ffimageloadingsvg:SvgCachedImage HorizontalOptions="EndAndExpand"
                                                             HeightRequest="24" WidthRequest="24"                                                            
                                                              Source="resource://myApp.Icons.heart.svg" />
@myroot
Copy link
Contributor

myroot commented Jan 3, 2020

Could you tell me your test environment more details?
I now test on Tizen 5.5 emulator, GearS3 with Tizen 4.0 and it is working well

https://gist.github.com/myroot/bb8cd40888ad95b31025957d6335d774

@EmilAlipiev
Copy link
Author

I tested on active watch with tizen 4. Did you try on xaml as well? I am also on xf 4.3 but i think it should be also working. Otherwise tomorrow I will try to create a repro

@myroot
Copy link
Contributor

myroot commented Jan 3, 2020

I tested on active watch with tizen 4. Did you try on xaml as well? I am also on xf 4.3 but i think it should be also working. Otherwise tomorrow I will try to create a repro

Yes, it is also working on xaml. Could you share your all source code? including svg image resource?

@EmilAlipiev
Copy link
Author

sorry for late reply. here is the repro attached. I still cannot make it work with svg
SvgTest.zip

@myroot
Copy link
Contributor

myroot commented Jan 21, 2020

The attached project was working on my emulator and target

emulator information

sh-3.2$ cat /etc/tizen-release
Tizen5/Unified 5.5.0 (i386)
VERSION = 5.5.0
CODENAME = Next
BUILD_ID=tizen-unified_20191031.1_wearable-emulator-circle

target information

root@localhost:~# cat /etc/tizen-release
Tizen4/Unified 4.0.0 (arm)
VERSION = 4.0.0
CODENAME = Next
BUILD_ID=PLATFORM_DayR765KO40_20180520.001

image

@EmilAlipiev
Copy link
Author

I tested on real device with galaxy watch active and it doesnt work there.

@myroot
Copy link
Contributor

myroot commented Jan 21, 2020

I also test real device with galaxy watch (not active but i thinks it does not matter) and it is working well

sh-3.2$ cat tizen-release
Tizen4/Unified 4.0.0 (arm)
VERSION = 4.0.0
CODENAME = Next
BUILD_ID=PLATFORM_PrdUsrR810XX_20191203.002

Could you show your device software version?

@EmilAlipiev
Copy link
Author

tizen 4.0.0.7
one ui version 1.5
i am not sure how to get the build id if it is important?

@myroot
Copy link
Contributor

myroot commented Jan 21, 2020

I also check on galaxy watch active real target and it is working well
Could you provide any logs or another information?

@JoonghyunCho
Copy link
Member

@EmilAlipiev You can check out the logs with the following command in shell.

sh-3.2# dlogutil DOTNET_LAUNCHER

@EmilAlipiev
Copy link
Author

it looks like that something wrong with skiasharp

Info / DOTNET_LAUNCHER ( 8977 : 8988 ) : Image loading failed: heart.svg;(size=0x48,dip=True,type=SvgDataResolver) System.IO.FileLoadException: Could not load file or assembly 'SkiaSharp, Version=1.68.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756'. The located assembly's manifest definiti
02-06 18:16:19.871 : Info / DOTNET_LAUNCHER ( 8977 : 8988 ) : on does not match the assembly reference. (Exception from HRESULT: 0x80131040) File name: 'SkiaSharp, Version=1.68.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756'    at FFImageLoading.Svg.Platform.SvgDataResolver.<Resolve>d__20.MoveNext()    at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.Start[TStateMachine](TStateMachine& stateMachine)    at FFImageLoading.Svg.Platform.SvgDataResolver.Resolve(String identifier, TaskParameter parameters, CancellationToken token)    at FFImageLoading.DataResolvers.WrappedDataResolver.<Resolve>d__2.MoveNext() --- End of stack trace from previous location where exception was thrown ---    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()    at System.Runtime.CompilerServices.TaskAwaiter.Throw
02-06 18:16:19.871 : Info / DOTNET_LAUNCHER ( 8977 : 8988 ) : ForNonSuccess(Task task)    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)    at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)    at FFImageLoading.Work.ImageLoaderTask`3.<RunAsync>d__109.MoveNext()

why is it looking for Version=1.68.0.0? I am referencing on older version. Does it mean that tizen watch application only works with skia Version=1.68.0.0 and above?

image

@EmilAlipiev
Copy link
Author

Ok nothing to do with version. I have upgraded on newer version but error changed.

02-06 18:23:58.347 : Info / DOTNET_LAUNCHER ( 9182 : 9185 ) : Image loading failed: heart.svg;(size=0x48,dip=True,type=SvgDataResolver) System.DllNotFoundException: Unable to load DLL 'libSkiaSharp': The specified module or one of its dependencies could not be found.  (Exception from HRESULT: 0x8007007E)    at SkiaSharp.SkiaApi.sk_picture_recorder_new()    at SkiaSharp.SKPictureRecorder..ctor()    at FFImageLoading.Svg.Platform.SKSvg.Load(XDocument xdoc)    at FFImageLoading.Svg.Platform.SKSvg.Load(Stream stream)    at FFImageLoading.Svg.Platform.SvgDataResolver.<Reso
02-06 18:23:58.355 : Info / DOTNET_LAUNCHER ( 9182 : 9185 ) : lve>d__22.MoveNext() --- End of stack trace from previous location where exception was thrown ---    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)    at FFImageLoading.DataResolvers.WrappedDataResolver.<Resolve>d__2.MoveNext() --- End of stack trace from previous location where exception was thrown ---    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)    at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)    at FFImageLoading.Work.ImageLoaderTask`3.<RunAsync>d__110.MoveNext()

@EmilAlipiev
Copy link
Author

these could be releated

mono/SkiaSharp#659
mono/SkiaSharp#430

@myroot
Copy link
Contributor

myroot commented Feb 7, 2020

@EmilAlipiev We have issue on Tizen.NET.Sdk, so *.so was not copied on packages,
It fixed and it will be applied on next released version

To fix early, Please add <CopyLocalRuntimeTargetAssets>true</CopyLocalRuntimeTargetAssets> this line on your .csproj file like below

<Project Sdk="Tizen.NET.Sdk/1.0.9">
  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>tizen40</TargetFramework>
    <CopyLocalRuntimeTargetAssets>true</CopyLocalRuntimeTargetAssets>
  </PropertyGroup>

please refer below link
https://developer.tizen.org/forums/tizen-.net/2d-graphic-on-samsung-watch?langredirect=1

@EmilAlipiev
Copy link
Author

I just had a chance to test the workaround but i am still getting exception. Now it throws exception below.

/ DOTNET_LAUNCHER ( 2327 : 2328 ) : Image loading failed: resource://myApp.Icons.heart.svg?assembly=myApp;(size=0x95,type=SvgDataResolver) System.NullReferenceException: Object reference not set to an instance of an object.    at FFImageLoading.Svg.Platform.SKSvg.
02-12 00:11:25.743 : Info / DOTNET_LAUNCHER ( 2327 : 2328 ) : ReadElement(XElement e, Dictionary`2 style)    at FFImageLoading.Svg.Platform.SKSvg.ReadElement(XElement e, SKCanvas canvas, SKPaint stroke, SKPaint fill, Boolean isMask, CancellationToken token)    at FFImageLoading.Svg.Platform.SKSvg.LoadElements(IEnumer
02-12 00:11:25.743 : Info / DOTNET_LAUNCHER ( 2327 : 2328 ) : able`1 elements, SKCanvas canvas, SKPaint stroke, SKPaint fill, CancellationToken token)    at FFImageLoading.Svg.Platform.SKSvg.Load(XDocument xdoc, CancellationToken token)    at FFImageLoading.Svg.Platform.SKSvg.Load(Stream stream, CancellationToken tok
02-12 00:11:25.743 : Info / DOTNET_LAUNCHER ( 2327 : 2328 ) : en)    at FFImageLoading.Svg.Platform.SvgDataResolver.<Resolve>d__21.MoveNext() --- End of stack trace from previous location where exception was thrown ---    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()    at System.Runtime.CompilerS
02-12 00:11:25.743 : Info / DOTNET_LAUNCHER ( 2327 : 2328 ) : ervices.TaskAwaiter.ThrowForNonSuccess(Task task)    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)    at FFImageLoading.DataResolvers.WrappedDataResolver.<Resolve>d__2.MoveNext() --- End of stack trace fr
02-12 00:11:25.743 : Info / DOTNET_LAUNCHER ( 2327 : 2328 ) : om previous location where exception was thrown ---    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)    at System.Runtime.CompilerServices.TaskAwaiter.Handl
02-12 00:11:25.743 : Info / DOTNET_LAUNCHER ( 2327 : 2328 ) : eNonSuccessAndDebuggerNotification(Task task)    at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)    at FFImageLoading.Work.ImageLoaderTask`3.<RunAsync>d__109.MoveNext()

@myroot
Copy link
Contributor

myroot commented Feb 12, 2020

@EmilAlipiev Could you share your app code? before shared app was not using resource but, now your log show failed on loading from resource.

@EmilAlipiev
Copy link
Author

SvgTest.zip
I had another test using it as embedded svg icon. Basically like attached. For me both way doesnt work.

  1. as attached first project using under res folder
  2. using as embedded svg

@myroot
Copy link
Contributor

myroot commented Feb 13, 2020

@EmilAlipiev Could you share a log with the attached project? because it is working well on my devices.

Image loading failed: resource://myApp.Icons.heart.svg?assembly=myApp;(size=0x95,type=SvgDataResolver) System.NullReferenceException: 

This is not SvgTest.Tizen log. I want to get a same envirement with you

@EmilAlipiev
Copy link
Author

here are the related logs for this project. I dont understand why it works for you not for me.
I am using VS 2019 latest update. All my tools are up to date and my device is Samsung Galaxy Active (first version). I wish i could be able to test on emulator but I am not able to run the emulator because of error.

Info / DOTNET_LAUNCHER ( 29425 : 29429 ) : Image loading failed: resource://SvgTest.trophy.svg?assembly=SvgTest,%20Version=1.0.0.0,%20Culture=neutral,%20PublicKeyToken=null;(size=0x199,type=SvgDataResolver) System.NullReferenceException: Object reference not set to an instance of an object.    at F
02-14 01:12:56.057 : Info / DOTNET_LAUNCHER ( 29425 : 29429 ) : FImageLoading.Svg.Platform.SKSvg.ReadElement(XElement e, Dictionary`2 style)    at FFImageLoading.Svg.Platform.SKSvg.ReadElement(XElement e, SKCanvas canvas, SKPaint stroke, SKPaint fill, Boolean isMask, CancellationToken token)    at FFImageLoading.Svg.Pl

@myroot
Copy link
Contributor

myroot commented Feb 14, 2020

This exception was occurred in FFImageLoading.Svg, it is really hard to figure out a reason.
How about clear a nuget cache files?

@EmilAlipiev
Copy link
Author

Finally this worked fine for me. I dont know why but i had to install Skiasharp 1.68 version separately.
It worked indeed under res folders but It still doesn't work as embedded image with this format resource://myApp.Icons.heart.svg?assembly=myApp
Anyway for now it is good for me that it works under res folder because embedded image could make sense if it was multi platform targeted like xamarin.forms project for android and ios.
Of course if i want to create a Tizen.net phone poject and share project between phone and watch or tv etc. Embedded images are yet very useful.

@EmilAlipiev
Copy link
Author

EmilAlipiev commented Feb 22, 2020

Another update; This is getting pretty annoying. It still doesnt work on my watch Galaxy Active. It works on emulator but not one the watch. I did all cache cleaning rebuild and reinstall etc. but nothing helped. Logs are showing skia errors like below. I dont really understand what to do here.

02-22 04:51:13.953 : Info / DOTNET_LAUNCHER ( 931 : 935 ) : Image loading failed: bluetooth.svg;(size=0x48,dip=True,type=SvgDataResolver) System.NullReferenceException: Object reference not set to an instance of an object.    at FFImageLoading.Svg.Platform.SKSvg.ReadElement(XElement e, Dictionary`2 style)    at FFI
02-22 04:51:13.957 : Info / DOTNET_LAUNCHER ( 931 : 935 ) : Image loading failed: android.svg;(size=0x48,dip=True,type=SvgDataResolver) System.NullReferenceException: Object reference not set to an instance of an object.    at FFImageLoading.Svg.Platform.SKSvg.ReadElement(XElement e, Dictionary`2 style)    at FFImageLoading.Svg.Platform.SKSvg.ReadElement(XElement e, SKCanvas canvas, SKPaint stroke, SKPaint fill)    at FFImageLoading.Svg.Platform.SKSvg.ReadElement(XElement e, SKCanvas canvas, SKPaint stroke, SKPaint fill)    at FFImageLoading.Svg.Platform.SKSvg.LoadE

Is there actually 2 different behavior on debugging in emulator vs in real device?

@EmilAlipiev
Copy link
Author

After long time i came across the this issue again. This is related sdb server/client i believe. I have 2 installations
1- Installed using Tizen Studio
2- Installed using VS 2019 extension

if i set the path of Tizen Studio, it doesn't work. I downloaded latest version today and tried.
if i set the path of VS 2019 extension download folder, it works fine.
not sure what is the difference, i think that they use different sdb versions.

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

3 participants