Comments (6)
Can you try using normal file (not an embedded resource) as check if it works?
from svg.skia.
In my production case, I download a whole data from my server, so my SVG is in string property of my Model. I will try to download it, save as file and load using path.
from svg.skia.
Ok, I have changed this sample project and currently, embedded resources are saved to device.
SKPicture is loaded via fila path and I would say that it is even worst:
- the same exception +
System.NullReferenceException: Object reference not set to an instance of an object.
at Svg.SvgDocument.Open[T] (System.String path, System.Collections.Generic.Dictionary`2[TKey,TValue] entities) [0x00035] in D:\a\1\s\externals\SVG\Source\SvgDocument.cs:304
at Svg.Skia.SKSvg.OpenSvg (System.String path) [0x00000] in D:\a\1\s\src\Svg.Skia\SKSvg.cs:127
at Svg.Skia.SKSvg.Open (System.String path) [0x00006] in D:\a\1\s\src\Svg.Skia\SKSvg.cs:156
at Svg.Skia.SKSvg.Load (System.String path) [0x00006] in D:\a\1\s\src\Svg.Skia\SKSvg.cs:181
at SvgTest.MainPage.LoadImage (SvgTest.Item item) [0x0001e] in /Users/DevGroup/Projects/SvgTest/SvgTest/MainPage.xaml.cs:143
- sometimes a Native exception appears
Tested on iOS/Android (simulator and real device)
Additionally, I have tested function SKSvg.FromSvg(string svgContent) but I have got the same issues.
It looks like the problem lives in your one dependency library - Svg
Are you able to help with this ?
from svg.skia.
@SeRgI1982 I have problem on my machine to run Xamarin.Forms android to debug the issues specific to android. I can not test on iOS at all.
Can you try stepping through the Svg.Skia code and find where the exception is originating?
from svg.skia.
The same achieved on your sample
{System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.TypeInitializationException: The type initializer for 'Svg.SvgElement' threw an exception. ---> System.PlatformNotSupportedException: Operation is not supported on this platform.
at System.Drawing.Text.FontCollection..ctor () [0x00006] in :0
at System.Drawing.Text.PrivateFontCollection..ctor () [0x00000] in :0
at Svg.SvgElement..cctor () [0x0000a] in /Users/DevGroup/Svg.Skia/externals/SVG/Source/SvgElementStyle.cs:473
--- End of inner exception stack trace ---
at Svg.SvgFragment..ctor () [0x00010] in /Users/DevGroup/Svg.Skia/externals/SVG/Source/Document Structure/SvgFragment.cs:15
at Svg.SvgDocument..ctor () [0x00007] in /Users/DevGroup/Svg.Skia/externals/SVG/Source/SvgDocument.cs:94
at (wrapper managed-to-native) System.Reflection.RuntimeConstructorInfo.InternalInvoke(System.Reflection.RuntimeConstructorInfo,object,object[],System.Exception&)
at System.Reflection.RuntimeConstructorInfo.InternalInvoke (System.Object obj, System.Object[] parameters, System.Boolean wrapExceptions) [0x00005] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/mcs/class/corlib/System.Reflection/RuntimeMethodInfo.cs:936
--- End of inner exception stack trace ---
at System.Reflection.RuntimeConstructorInfo.InternalInvoke (System.Object obj, System.Object[] parameters, System.Boolean wrapExceptions) [0x00018] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/mcs/class/corlib/System.Reflection/RuntimeMethodInfo.cs:944
at System.RuntimeType.CreateInstanceMono (System.Boolean nonPublic, System.Boolean wrapExceptions) [0x00095] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/mcs/class/corlib/ReferenceSources/RuntimeType.cs:185
at System.RuntimeType.CreateInstanceSlow (System.Boolean publicOnly, System.Boolean wrapExceptions, System.Boolean skipCheckThis, System.Boolean fillCache) [0x00009] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/mcs/class/corlib/ReferenceSources/RuntimeType.cs:155
at System.RuntimeType.CreateInstanceDefaultCtor (System.Boolean publicOnly, System.Boolean skipCheckThis, System.Boolean fillCache, System.Boolean wrapExceptions, System.Threading.StackCrawlMark& stackMark) [0x00027] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/rttype.cs:5770
at System.Activator.CreateInstance[T] () [0x00029] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/activator.cs:236
at Svg.SvgElementFactory.CreateElement[T] (System.Xml.XmlReader reader, System.Boolean fragmentIsDocument, Svg.SvgDocument document) [0x0003e] in /Users/DevGroup/Svg.Skia/externals/SVG/Source/SvgElementFactory.cs:93
at Svg.SvgElementFactory.CreateDocument[T] (System.Xml.XmlReader reader) [0x00035] in /Users/DevGroup/Svg.Skia/externals/SVG/Source/SvgElementFactory.cs:62
at Svg.SvgDocument.Open[T] (System.Xml.XmlReader reader) [0x000a0] in /Users/DevGroup/Svg.Skia/externals/SVG/Source/SvgDocument.cs:395 }
PrivateFontCollection constructor calls
GDIPlus.CheckStatus (GDIPlus.GdipNewPrivateFontCollection (out _nativeFontCollection));
I guess that something is wrong here.
from svg.skia.
@SeRgI1982 Seems like issue with some missing functionality from System.Drawing on Android/iOS. trying to fix this svg-net/SVG#711
I will publish patched version of SVG with Svg.Skia that includes this fix in version 0.1.8.
from svg.skia.
Related Issues (20)
- SVG not applying blur filter in .NET MAUI HOT 2
- Svg Images not rendered after upgrading to Avalonia.Svg, Version=11.0.0.10 HOT 2
- The Fifth Element isn't shown in sliding menu (Avalonia.Skia.Svg) HOT 1
- SvgImage creation outside uithread HOT 2
- EXEC conversion error on UWP build HOT 4
- Version 11.0.0.13 and Android HOT 4
- The AccessViolationException occurs in the SvgCustomDrawOperation.Render method HOT 3
- ToolTip.Tip not working when using SvgImage as Source for Image HOT 1
- Question: Is-it possible to load SVG by symbol ? HOT 1
- Nuget package V1.0.0.14 is no more compatible with .Net Std 2.0 HOT 3
- Can't SvgSource.LoadFromStream anymore HOT 3
- Avalonia: <Svg IsVisible="False"/> doesn't work with Effect. HOT 1
- Translation on a path not working HOT 1
- This SVG has no drawing commands and is empty HOT 10
- Question (performance) - does this library use internal off-device caching? HOT 1
- SvgImage not re-rendering on binding update HOT 2
- Update ImageSharp dependency HOT 1
- DrawingContext.DrawImage() method not draws an SvgImage in some cases
- Regression with SVG attribute (fill specified, style empty)
- SVG to PNG renders inline images incorrectly (#99)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from svg.skia.