Aspose.OCR NuGet Package References

There appears to be errors in the references in the OCR Package on NuGet.
It doesn’t appear to reference the same versions as the Microsoft.ML.OnnxRuntime package.

1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2182,5): warning MSB3277: Found conflicts between different versions of “System.Memory” that could not be resolved.
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2182,5): warning MSB3277: There was a conflict between “System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51” and “System.Memory, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51”.
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2182,5): warning MSB3277: “System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51” was chosen because it was primary and “System.Memory, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51” was not.
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2182,5): warning MSB3277: References which depend on “System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51” [packages\System.Memory.4.5.3\lib\netstandard2.0\System.Memory.dll].
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2182,5): warning MSB3277: packages\System.Memory.4.5.3\lib\netstandard2.0\System.Memory.dll
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2182,5): warning MSB3277: Project file item includes which caused reference “packages\System.Memory.4.5.3\lib\netstandard2.0\System.Memory.dll”.
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2182,5): warning MSB3277: System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2182,5): warning MSB3277: References which depend on “System.Memory, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51” [].
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2182,5): warning MSB3277: packages\Aspose.OCR.22.8.0\lib\netstandard2.0\Aspose.OCR.dll
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2182,5): warning MSB3277: Project file item includes which caused reference “packages\Aspose.OCR.22.8.0\lib\netstandard2.0\Aspose.OCR.dll”.
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2182,5): warning MSB3277: Aspose.OCR, Version=22.8.0.0, Culture=neutral, PublicKeyToken=716fcc553a201e56, processorArchitecture=MSIL
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2182,5): warning MSB3277: packages\Microsoft.ML.OnnxRuntime.Managed.1.12.1\lib\netstandard2.0\Microsoft.ML.OnnxRuntime.dll
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2182,5): warning MSB3277: Project file item includes which caused reference “packages\Microsoft.ML.OnnxRuntime.Managed.1.12.1\lib\netstandard2.0\Microsoft.ML.OnnxRuntime.dll”.
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2182,5): warning MSB3277: Microsoft.ML.OnnxRuntime, Version=0.0.0.0, Culture=neutral, PublicKeyToken=f27f157f0a5b7bb6, processorArchitecture=MSIL
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2182,5): warning MSB3277: Aspose.OCR, Version=22.8.0.0, Culture=neutral, PublicKeyToken=716fcc553a201e56, processorArchitecture=MSIL
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2182,5): warning MSB3277: Found conflicts between different versions of “System.Runtime.CompilerServices.Unsafe” that could not be resolved.
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2182,5): warning MSB3277: There was a conflict between “System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a” and “System.Runtime.CompilerServices.Unsafe, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a”.
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2182,5): warning MSB3277: “System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a” was chosen because it was primary and “System.Runtime.CompilerServices.Unsafe, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a” was not.
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2182,5): warning MSB3277: References which depend on “System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a” [packages\System.Runtime.CompilerServices.Unsafe.4.5.2\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll].
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2182,5): warning MSB3277: packages\System.Runtime.CompilerServices.Unsafe.4.5.2\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2182,5): warning MSB3277: Project file item includes which caused reference “packages\System.Runtime.CompilerServices.Unsafe.4.5.2\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll”.
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2182,5): warning MSB3277: System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2182,5): warning MSB3277: References which depend on “System.Runtime.CompilerServices.Unsafe, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a” [].
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2182,5): warning MSB3277: packages\System.Memory.4.5.3\lib\netstandard2.0\System.Memory.dll
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2182,5): warning MSB3277: Project file item includes which caused reference “packages\System.Memory.4.5.3\lib\netstandard2.0\System.Memory.dll”.
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2182,5): warning MSB3277: System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL

@Mitsobar

Would you please make sure that you are trying to install the package in an application targeting >4.6.2 .NET Framework? In case you still face any issues, please let us know. Also, please make sure to install the latest version of the API.

I rebuilt it using 4.6.1. Now is is copying ALL of the referenced DLLs locally in the release folder.

03/19/2022 03:05 AM 131,984 Microsoft.ML.OnnxRuntime.dll
03/19/2022 03:03 AM 60,332 Microsoft.ML.OnnxRuntime.pdb
03/15/2021 10:15 AM 21,216 Microsoft.Win32.Primitives.dll
03/15/2021 10:15 AM 98,616 netstandard.dll
03/19/2022 12:35 AM 20,904 onnxruntime_providers_shared.dll
03/15/2021 10:15 AM 21,176 System.AppContext.dll
07/19/2017 10:01 AM 27,992 System.Buffers.dll
07/19/2017 10:01 AM 3,195 System.Buffers.xml
03/15/2021 10:15 AM 21,224 System.Collections.Concurrent.dll
03/15/2021 10:15 AM 21,696 System.Collections.dll
03/15/2021 10:15 AM 21,224 System.Collections.NonGeneric.dll
03/15/2021 10:15 AM 21,224 System.Collections.Specialized.dll
03/15/2021 10:15 AM 21,192 System.ComponentModel.dll
03/15/2021 10:15 AM 21,768 System.ComponentModel.EventBasedAsync.dll
03/15/2021 10:15 AM 21,752 System.ComponentModel.Primitives.dll
03/15/2021 10:15 AM 22,784 System.ComponentModel.TypeConverter.dll
03/15/2021 10:15 AM 21,160 System.Console.dll
03/15/2021 10:15 AM 154,448 System.Data.Common.dll
03/15/2021 10:15 AM 21,736 System.Diagnostics.Contracts.dll
03/15/2021 10:15 AM 21,208 System.Diagnostics.Debug.dll
03/15/2021 10:15 AM 21,248 System.Diagnostics.FileVersionInfo.dll
03/15/2021 10:15 AM 21,728 System.Diagnostics.Process.dll
03/15/2021 10:15 AM 23,936 System.Diagnostics.StackTrace.dll
03/15/2021 10:15 AM 21,280 System.Diagnostics.TextWriterTraceListener.dll
03/15/2021 10:15 AM 21,208 System.Diagnostics.Tools.dll
03/15/2021 10:15 AM 21,744 System.Diagnostics.TraceSource.dll
03/15/2021 10:15 AM 31,608 System.Diagnostics.Tracing.dll
03/15/2021 10:15 AM 21,208 System.Drawing.Primitives.dll
03/15/2021 10:15 AM 22,224 System.Dynamic.Runtime.dll
03/15/2021 10:15 AM 21,744 System.Globalization.Calendars.dll
03/15/2021 10:15 AM 21,192 System.Globalization.dll
03/15/2021 10:15 AM 25,992 System.Globalization.Extensions.dll
03/15/2021 10:15 AM 110,944 System.IO.Compression.dll
03/15/2021 10:15 AM 21,224 System.IO.Compression.ZipFile.dll
03/15/2021 10:15 AM 21,144 System.IO.dll
03/15/2021 10:15 AM 21,192 System.IO.FileSystem.dll
03/15/2021 10:15 AM 21,232 System.IO.FileSystem.DriveInfo.dll
03/15/2021 10:15 AM 21,232 System.IO.FileSystem.Primitives.dll
03/15/2021 10:15 AM 21,224 System.IO.FileSystem.Watcher.dll
03/15/2021 10:15 AM 21,208 System.IO.IsolatedStorage.dll
03/15/2021 10:15 AM 21,216 System.IO.MemoryMappedFiles.dll
03/15/2021 10:15 AM 21,168 System.IO.Pipes.dll
03/15/2021 10:15 AM 21,232 System.IO.UnmanagedMemoryStream.dll
03/15/2021 10:15 AM 21,152 System.Linq.dll
03/15/2021 10:15 AM 22,224 System.Linq.Expressions.dll
03/15/2021 10:15 AM 21,192 System.Linq.Parallel.dll
03/15/2021 10:15 AM 21,192 System.Linq.Queryable.dll
04/17/2019 04:24 PM 148,760 System.Memory.dll
04/17/2019 04:24 PM 13,950 System.Memory.xml
03/15/2021 10:15 AM 198,472 System.Net.Http.dll
03/15/2021 10:15 AM 21,208 System.Net.NameResolution.dll
03/15/2021 10:15 AM 22,248 System.Net.NetworkInformation.dll
03/15/2021 10:15 AM 21,168 System.Net.Ping.dll
03/15/2021 10:15 AM 22,216 System.Net.Primitives.dll
03/15/2021 10:15 AM 21,184 System.Net.Requests.dll
03/15/2021 10:15 AM 21,696 System.Net.Security.dll
03/15/2021 10:15 AM 30,544 System.Net.Sockets.dll
03/15/2021 10:15 AM 21,232 System.Net.WebHeaderCollection.dll
03/15/2021 10:15 AM 21,224 System.Net.WebSockets.Client.dll
03/15/2021 10:15 AM 21,192 System.Net.WebSockets.dll
07/19/2017 10:01 AM 115,936 System.Numerics.Vectors.dll
07/19/2017 10:01 AM 183,543 System.Numerics.Vectors.xml
03/15/2021 10:15 AM 21,696 System.ObjectModel.dll
03/15/2021 10:15 AM 22,200 System.Reflection.dll
03/15/2021 10:15 AM 21,224 System.Reflection.Extensions.dll
03/15/2021 10:15 AM 21,736 System.Reflection.Primitives.dll
03/15/2021 10:15 AM 21,200 System.Resources.Reader.dll
03/15/2021 10:15 AM 21,232 System.Resources.ResourceManager.dll
03/15/2021 10:15 AM 21,200 System.Resources.Writer.dll
09/18/2018 07:38 PM 23,600 System.Runtime.CompilerServices.Unsafe.dll
09/18/2018 07:38 PM 14,080 System.Runtime.CompilerServices.Unsafe.xml
03/15/2021 10:15 AM 21,784 System.Runtime.CompilerServices.VisualC.dll
03/15/2021 10:15 AM 29,360 System.Runtime.dll
03/15/2021 10:15 AM 21,720 System.Runtime.Extensions.dll
03/15/2021 10:15 AM 21,200 System.Runtime.Handles.dll
03/15/2021 10:15 AM 24,296 System.Runtime.InteropServices.dll
03/15/2021 10:15 AM 28,624 System.Runtime.InteropServices.RuntimeInformation.dll
03/15/2021 10:15 AM 21,200 System.Runtime.Numerics.dll
03/15/2021 10:15 AM 21,264 System.Runtime.Serialization.Formatters.dll
03/15/2021 10:15 AM 21,240 System.Runtime.Serialization.Json.dll
03/15/2021 10:15 AM 27,048 System.Runtime.Serialization.Primitives.dll
03/15/2021 10:15 AM 24,816 System.Runtime.Serialization.Xml.dll
03/15/2021 10:15 AM 21,200 System.Security.Claims.dll
03/15/2021 10:15 AM 47,016 System.Security.Cryptography.Algorithms.dll
03/15/2021 10:15 AM 21,240 System.Security.Cryptography.Csp.dll
03/15/2021 10:15 AM 21,256 System.Security.Cryptography.Encoding.dll
03/15/2021 10:15 AM 21,784 System.Security.Cryptography.Primitives.dll
03/15/2021 10:15 AM 22,832 System.Security.Cryptography.X509Certificates.dll
03/15/2021 10:15 AM 21,208 System.Security.Principal.dll
03/15/2021 10:15 AM 22,392 System.Security.SecureString.dll
03/15/2021 10:15 AM 21,696 System.Text.Encoding.dll
03/15/2021 10:15 AM 21,232 System.Text.Encoding.Extensions.dll
03/15/2021 10:15 AM 21,232 System.Text.RegularExpressions.dll
03/15/2021 10:15 AM 22,192 System.Threading.dll
03/15/2021 10:15 AM 37,752 System.Threading.Overlapped.dll
03/15/2021 10:15 AM 22,224 System.Threading.Tasks.dll
03/15/2021 10:15 AM 21,232 System.Threading.Tasks.Parallel.dll
03/15/2021 10:15 AM 21,200 System.Threading.Thread.dll
03/15/2021 10:15 AM 21,216 System.Threading.ThreadPool.dll
03/15/2021 10:15 AM 21,200 System.Threading.Timer.dll
03/15/2021 10:15 AM 79,176 System.ValueTuple.dll
03/15/2021 10:15 AM 21,712 System.Xml.ReaderWriter.dll
03/15/2021 10:15 AM 21,696 System.Xml.XDocument.dll
03/15/2021 10:15 AM 21,712 System.Xml.XmlDocument.dll
03/15/2021 10:15 AM 21,712 System.Xml.XmlSerializer.dll
03/15/2021 10:15 AM 21,176 System.Xml.XPath.dll
03/15/2021 10:15 AM 22,904 System.Xml.XPath.XDocument.dll

@Mitsobar

Sorry for the confusion but we meant greater than 4.6.2.

I was originally using 4.8.

@Mitsobar

We have tested the case in our environment but did not face any issue. Would you please check again in a separate console application to see what actual dependency is creating issue in your main project?

image.png (85.4 KB)

I am building a .Net DLL using .Net 4.8.
It now uses Aspose.OCR 22.9 and also uses aspose.PDF 22.9.

The disagreements are now resolved when building.

Now when I call the OCR functions I get “The type initializer for ‘\u0002\u0003\u0003’ threw an exception.”

When I install the OCR package from NuGet.org I get the following…
And then immediately it shows The OnnxRuntime is out of date. I have not updated it.
Is there anyway to get an updated OCR package that uses the latest OnnxRuntime?
image.png (32.8 KB)

When I run my app it says :
“Could not load file or assembly ‘System.Memory, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51’ or one of its dependencies. The located assembly’s manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)”

According to my dependency walker I have 4.0.1.1 in my bin directory…not 4.0.1.2.
I’m not sure where the 4.0.1.2 reference is coming from.
The properties of the System.Memory.dll shows a file version of 4.6.27617.2

@Mitsobar

The issue looks strange as we were unable to replicate it in our environment. Could you kindly create a sample console application that is showcasing this problem and share it with us? We will test the scenario using that application as well as will look into the feasibility of using latest OnnxRuntime dependency for Aspose.OCR.

Have you tried reproducing it in a DLL?

Why a console application? Does it only work in a console application?

I created a console application that calls my DLL and I get:
“The type initializer for ‘\u0002\u0003\u0003’ threw an exception.”

@Mitsobar

Its not limited to the Console Applications only. We only asked it as it will have less size and will be easy to share. However, would you please share your application type in which you are trying to use the API by just including the DLL?

The application type is a DLL that wraps the calls to the Aspose.OCR DLL with other functionality.

I also have a console application in my solution that calls my DLL. The exception from my DLL is passed back to my console application. “The type initializer for ‘\u0002\u0003\u0003’ threw an exception.”

@Mitsobar

We apologize for the trouble. We have also tried to use the API in a Class Library (that outputs a DLL) but we were unable to notice any issue. May be the issue is related to the project specific structure that you are using that is why we have been requesting you share a sample application so that we can further investigate the issue. You can kindly upload your sample application to Google Drive in .zip archive and share the link with us. We again apologize for the inconvenience you have been facing.

Are you also including the package for the Aspose.PDF?

@Mitsobar

We tested the API in a solution where other Aspose APIs (Aspose.PDF as well) were being used. However, if you are using any particular method of Aspose.PDF that you can share, we will test using it as well and share our feedback with you.

Aspose.Pdf.Document
Aspose.Pdf.Text.TextAbsorber
Aspose.Pdf.Document.Pages.Accept
Aspose.Pdf.Document.Pages.Count
Aspose.Pdf.Document.Pages[].Resources.Images.Count
Aspose.Pdf.Document.Pages[].Resources.Images[];

I have previously run into situations where the Aspose packages don’t work well together.

I rarely have a project that doesn’t include multiple Aspose packages.

Surprised your testing doesn’t include situations where multiple packages are used in the same project.

Have you ever created a project that uses all of the packages together?

@Mitsobar

We do have a project where we include multiple Aspose APIs and it is running without any issues. Furthermore, we are again going to create a separate application and try to replicate the issue that you are facing. We will let you know as soon as we have some results.
image.png (124.1 KB)

You can download my zipped project here.

The console application in my solution that calls my DLL. The exception from my DLL is passed back to my console application. “The type initializer for ‘\u0002\u0003\u0003’ threw an exception.”

The console application takes the path to a PDF on the command line. You can supply your own PDF.

https://waypointgloballlc-my.sharepoint.com/:u:/g/personal/dfunk_waypointglobal_com/EeCLxwGfEj5HgILNdHMJhlgBkaMXeh2CyntHcMGtxhObGg?e=JBzR48