System.Runtime.CompilerServices.Unsafe, Version=4.0.4.0 PRoblem with ASPOSE,SVG

I have System.Runtime.CompilerServices.Unsafe, Version=4.0.4.0 error message using ASPOSE,SVG on code line 2:

Dim svgSrc = "E:\SVG_01.svg"
Dim Odocument As Aspose.Svg.SVGDocument = New Aspose.Svg.SVGDocument(svgSrc)

How to fix that?

@mgmst Your question is related to Aspose.SVG. I will move the topic into the appropriate forum. My colleagues from Aspose.SVG team will help you shortly.

@mgmst

Can you please attach your SVG image as well in .zip format so that we can test the scenario in our environment and address it accordingly.

Hi,

Let’s start one by one because it is total mess.

  1. Error image:

  1. The code:

Dim svgSrc_From = “E:\SVG_01.svg”
Dim svgSrc_To = “E:\SVG_02.png”
Dim ODocument As Aspose.Svg.SVGDocument = New Aspose.Svg.SVGDocument(svgSrc_From)
Dim OOptions = New Aspose.Svg.Saving.ImageSaveOptions(Aspose.Svg.Rendering.Image.ImageFormat.Png)
Aspose.Svg.Converters.Converter.ConvertSVG(ODocument, OOptions, svgSrc_To)

  1. Dev environment:

I use

Microsoft Visual Studio Professional 2022 (64-bit) - Current
Version 17.10.5
Dot Net 4.8

  1. The SVG file:

Please find the SVG file attached.

The SVG file works perfectly in browser.

  1. Full error message:

Happens here: Dim ODocument As Aspose.Svg.SVGDocument = New Aspose.Svg.SVGDocument(svgSrc_From)

The message it’s self:

FileLoadException: Could not load file or assembly ‘System.Runtime.CompilerServices.Unsafe, Version=4.0.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’ or one of its dependencies. The located assembly’s manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

I really do not know why you may need this shit: System.Runtime.CompilerServices.Unsafe, Version=4.0.4.0

Last Current version of the shit in NuGet repository is 6.0

If you need something more just say.

Kind regards,

Mariyan

(Attachment SVG_01.svg is missing)

Find the file attached again…

If you still do not receive the attachment, please provide me with other channel to deliver it to you.

(Attachment SVG_01.svg is missing)

@mgmst

The issue looks related to the project configurations. It does not seem to be specific with a particular file. We tested in our environment using a sample console application and the latest version of Aspose.SVG. We could not notice this issue.

The culprit seems to be System.Runtime.CompilerServices.Unsafe. It indicates that there is a version mismatch between the referenced assembly and the actual assembly that is being loaded. Please try to update the mentioned assembly. Better to create a new sample console application and test there if the error is actually related to the API itself or the project configuration. Please share the sample application by uploading it to Dropbox or Google Drive if error still persists in the new console application. We will further proceed with the investigation and assisting you accordingly.