I followed the article linked in the previous comment about changing from 4.7.2 to .netstandard2.0 for some packages, and now I am getting this error:
image.png (22.5 KB)
thrown from the constructor:
private BarCodeReader CreateAsposeBarCodeReader(Stream stream)
{
if (_barcodeSetting.RecognizePdf417 && _barcodeSetting.RecognizeQR)
return new BarCodeReader(stream, DecodeType.Pdf417, DecodeType.QR);
if (_barcodeSetting.RecognizePdf417)
return new BarCodeReader(stream, DecodeType.Pdf417);
if (_barcodeSetting.RecognizeQR)
return new BarCodeReader(stream, DecodeType.QR);
return new BarCodeReader(stream);
}
A System.NotImplementedException !?!
@suhailmahmood,
I tested it using VS.NET 2022 with Aspose.BarCode v24.10 and it works fine. Please download/get a standalone sample project using the URL for your reference. Please try to test in your environment if it works fine? If you still find the issue, kindly do create a sample project and share it with us, we will check it soon.
Aspose.Barcode on .NET Framework uses standard System.Drawing as graphic library (which is wrapper around native C++ library) which works tricky on non Windows+x86/x64 platforms. In this way it can … sometimes work.
Aspose.Barcode on .Net Standard/Core platform uses Aspose.Drawing.Common which is fully native .Net library and does not use any native library. But you have to add not only Aspose.Barcode to packages but other libraries like System.Memory, System.Buffers…
The System.NotImplementedException was coming from Bitmap constructor. It was resolved after upgrading System.Memory from 4.5.4 to 4.5.5. What a strange way to resolve the issue!
@suhailmahmood,
It appears your problem has been resolved by updating the System.Memory library. Please do not hesitate to contact us again if you have any further questions or comments.
I have been running the app for some time and suddenly I got this error (similar to before). Not sure what else I need to upgrade this time. But it is quite frustrating that I am getting errors from BarCodeResult..ctro
(not to mention those strange symbols)
at Aspose.BarCode.BarCodeRecognition.BarCodeResult.(String )
at Aspose.BarCode.BarCodeRecognition.BarCodeResult..ctor(e )
at .()
at Aspose.BarCode.BarCodeRecognition.BarCodeReader.ReadBarCodes()
@suhailmahmood,
We are sorry that you are getting the issue now. We would appreciate if you could create a sample application (complete source code without compilation errors), zip the project, and provide it to us so that we can reproduce the issue. We will investigate your issue as soon as possible.
Here’s a sample project.
AsposeTest.zip (11.3 KB)
Though it throws a different error than the one I am facing in my real app, but it at one point I was facing this error in my app too, and this was resolved after this change. But in this sample app, even after upgrading System.Memory to 4.5.5 is not resolving the issue.
I tried with all the different constructors (taking Stream, string or Bitmap) and all of them throw the same error.
This is the exception I see from this app at launch.
I am working on resolving this issue and if I can resolve it, I will share the code that can reproduce the issue I am facing in my main app.
@suhailmahmood,
Sure, please take your time to provide us the demo project that reproduces the original issue that you are getting in your main app.
Sure. In the meantime can you please run the sample that I shared and tell me what the issue is? It is so simple an app yet it throws error in new BarCodeReader(Stream)
line.
@suhailmahmood,
Yes, I did test your sample project. I first updated a few lines in packages.config file as following:
<package id="OpenCvSharp4" version="4.5.3.20211228" targetFramework="netstandard2.0" />
<package id="OpenCvSharp4.runtime.win" version="4.5.3.20211228" targetFramework="netstandard2.0" />
<package id="OpenCvSharp4.WpfExtensions" version="4.5.3.20211228" targetFramework="netstandard2.0" />
I also updated a few lines in the .csproj file as following:
<Reference Include="OpenCvSharp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6adad1e807fea099, processorArchitecture=MSIL">
<HintPath>..\packages\OpenCvSharp4.4.5.3.20211228\lib\netstandard2.0\OpenCvSharp.dll</HintPath>
</Reference>
<Reference Include="OpenCvSharp.WpfExtensions, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\OpenCvSharp4.WpfExtensions.4.5.3.20211228\lib\netstandard2.0\OpenCvSharp.WpfExtensions.dll</HintPath>
</Reference>
Somehow there was some other System.Memory reference to your project which is an issue (even the library was mentioned Ok in the packages.config and .csproj files). I then removed it manually from the References node in Solution explorer. Now I compile it and run the project and it works fine and I do not get any exception.
1 Like
Can you share the updated version please? I made the same changes as you mentioned, but I am getting build error saying
The type or namespace name 'WpfExtensions' does not exist in the namespace 'OpenCvSharp' (are you missing an assembly reference?)
@suhailmahmood,
Please download/get the working project from the URL for your reference. The shared sample project works fine on my end.
1 Like
Thanks, I got it working too, by just removing the System.Memory from the csproj file (I also removed it from the packages.config, but your version has it btw, but I guess that doesn’t make any difference).
OpenCvSharp adds System.Memory as a dependency, and removing it is also prevented for the same reason. But manually removing System.Memory doesn’t break OpenCvSharp, which is so strange!
@suhailmahmood,
Thanks for your feedback and good to know that it is also working on your side.
@amjad.sahi
But why would removing a package (System.Memory) which is added by another package (OpenCvSharp4) as a dependency resolve the issue of some exception being thrown by some other package (Aspose.BarCode)? Isn’t this very, very counter-intuitive? Can you please share details as to why you think removing the System.Memory package is the solution in this case? I am just trying to make sure I am not making some uneducated changes to my application, and as it stands now, I don’t understand the reasoning behind the solution that you suggested. So, please share the reasoning.
Please note, I am still unable to isolate the actual issue that I am facing in my actual app (null reference exception) that I shared in this comment. I encounter this error sporadically. I will share details if I am able to isolate this.
@suhailmahmood,
I am not sure either. Anyways, we logged it against your existing ticket into our database for thorough evaluation. We will update you once there an update on it. I guess in your provided project there was a reference existed of lower version of System.Memory. That’s why I removed it manually.
Sure, please take your time to isolate the actual issue and then provide a sample project to reproduce it on our end.
1 Like
Since I am unable to isolate the issue into a demo app at this time (I am continuing to try tho), let me share some more data of the exception that I am getting.
Exception.Message: Object reference not set to an instance of an object.
Exception.HResult: -2147467261
Exception.TargetSite.DeclaringType: {Name = "BarCodeResult" FullName = "Aspose.BarCode.BarCodeRecognition.BarCodeResult"}
Exception.TargetSite.MetadataToken: 100674712
Exception.TargetSite.Module: {Aspose.BarCode.dll}
Exception.TargetSite.Name: "\u000e\u000f"
I am not entirely sure which of these properties will prove to be useful, so I will share a screenshot.
Here’s a screenshot:
@suhailmahmood
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.
Issue ID(s): BARCODENET-39157
You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.
1 Like
We added task to add System.Memory and related libraries to nuget reference. In case of using .Net Core project the libraries are added automatically, but for .Net Framework we need fix.
1 Like