We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Aspose BarCode not working in Azure Durable Functions

hello,

i am getting an error when I tried to create a QR code in Azure using Durable Functions.

“The type initializer for ‘Aspose.BarCode.Generation.BarcodeGenerator’ threw an exception.”

" at Aspose.BarCode.Generation.BarcodeGenerator…ctor(BaseEncodeType type, String codeText)\r\n at DurFunctionBarCodeTest.Function1.Run(TimerInfo myTimer, ILogger log) in C:\_mydata\_projects 2020\SGE_AZURE_POC\2021-05-26\Dev_Azure_Poc2\DurFunctionBarCodeTest\Function1.cs:line 19"

we have the .NET Total ent license.

I am using v21.9.0 nuget package.

please see the simple dur function code attached.

DurFunctionBarCodeTest.zip (4.8 KB)

@tony.woods.bell.ca

I am moving this thread to Aspose.Barcode support forum where our concerned team will assist you further in this regard.

1 Like

@tony.woods.bell.ca,
We have reviewed your issue and logged it into our database for a detailed analysis. You will be notified here once any update is ready for sharing.

This issue is logged as:
BARCODENET-37913 - Aspose BarCode not working in Azure Durable Functions

@tony.woods.bell.ca,

When building an Azure Functions project, the build tools optimize the output so that only one copy of any assemblies that are shared with the functions runtime are preserved. It also ‘optimizes’ System.Text.Encoding.CodePages that is need for Aspose.Barcode library.
Solution is to preserve System.Text.Encoding.CodePages by adding this to your csproj:

 <ItemGroup>
    <FunctionsPreservedDependencies Include="System.Text.Encoding.CodePages.dll" />
 </ItemGroup>

thank you for the info.
however, it did not solve the issue.

I checked. the Durable function does get deployed with the
System.Text.Encoding.CodePages.dll

but still the QRCODE is not getting created.

@tony.woods.bell.ca,
Your feedback is logged with the ticket. We will analyze the scenario again and share our comments after a detailed analysis.

Just a quick update
Your code is working and I can generate a QRCode via Durable Azure function and save to Azure storage.

But it is not working when i use mail merge within a word doc.

I have created an merge field of type “Image” and injecting an image Stream into that field
but it does not seem to work.

@tony.woods.bell.ca,
Thanks for the update. We will share our feedback soon.

2 posts were split to a new topic: QR code cannot be added to Word Doc

@tony.woods.bell.ca

Could you please clarify what “mail merge within a word doc” is?
Can you also provide error messages if any and an example project?

hi
it’s ok, there is another support ticket that got created by a split
see here…

@tony.woods.bell.ca,
Sure, we are looking into the split thread.