# Sign Document Net Function Errors

**URL:** <https://zatca1.discourse.group/t/sign-document-net-function-errors/2384>\
**Category:** SDK, web-based validator and sandbox\
**Created:** [August 12, 2024, 10:50am UTC](https://zatca1.discourse.group/t/sign-document-net-function-errors/2384 "2024-08-12T10:50:07Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![khaledmaqtari](https://avatars.discourse-cdn.com/v4/letter/k/d6d6ee/32.png) [@khaledmaqtari](https://zatca1.discourse.group/u/khaledmaqtari)\
**Post date:** [August 12, 2024, 10:50am UTC](https://zatca1.discourse.group/t/sign-document-net-function-errors/2384/1 "2024-08-12T10:50:07Z")

</div>

Hi engineers,

I’m using ZATCA .net SDK in my .net app

I face some errors in this signing function  
IEInvoiceSigner invoiceSigner= new EInvoiceSigner();  
SignResult signResult= invoiceSigner.SignDocument(xmlDoc, csrResult.Csr, csrResult.PrivateKey)

The main error is:  
“[Error] Parsing EInvoice Certificate[Error] Populating Signed Signature Properties[Error] Generating EInvoice QR Code”

and when I check for the steps errors it come like these:

Step[3] Parse Certificate - Exception: “Cannot find the requested object”  
Step[6] Populate Signed Signature Properties - Exception: “Object reference not set to an instance of an object”  
Step[9] Generate EInvoice QR - Exception: “Invalid Certificate”;

Is that I missed some files like pem file ?  
If yes then which one of it (I have two pem files) and how to make it readable for SignDocument() function ?

Thank you for help

---

<div class="post-metadata">

**Author:** ![saalotaibi](https://avatars.discourse-cdn.com/v4/letter/s/f9ae1b/32.png) [@saalotaibi](https://zatca1.discourse.group/u/saalotaibi)\
**Post date:** [August 12, 2024, 1:40pm UTC](https://zatca1.discourse.group/t/sign-document-net-function-errors/2384/2 "2024-08-12T13:40:19Z")

</div>

Dear @khaledmaqtari

Thank you for reaching out, and welcome to our community.

Kindly make sure that the Private Key is the same as generating the CSR, for the Signing process refer back to the below document.

[SigningProcessUpdated.pdf](https://zatca1.discourse.group/uploads/short-url/b4kLmEjVf0VIx81thKX33X4tc43.pdf) (392.7 KB)

Follow the XML tags & UBL In slide 3, For the Singing Properties tags kindly follow the attached document on slide 6, 7 and make sure of using the correct tags.

If you still face issues, please don’t hesitate to reach out with our support team via email:

SP email: sp\_support@zatca.gov.sa

Thanks,

---

<div class="post-metadata">

**Author:** ![khaledmaqtari](https://avatars.discourse-cdn.com/v4/letter/k/d6d6ee/32.png) [@khaledmaqtari](https://zatca1.discourse.group/u/khaledmaqtari)\
**Post date:** [August 12, 2024, 2:05pm UTC](https://zatca1.discourse.group/t/sign-document-net-function-errors/2384/3 "2024-08-12T14:05:30Z")

</div>

Thank you very much for fast help.

About the xml tags I just testing a ready simplified and standard invoice files that included in ZATCA SDK data directory.

I’ll check again with that pdf guides and then reporting you the result.

---

<div class="post-metadata">

**Author:** ![mdd](https://avatars.discourse-cdn.com/v4/letter/m/43a26b/32.png) [@mdd](https://zatca1.discourse.group/u/mdd)\
**Post date:** [August 27, 2024, 10:31am UTC](https://zatca1.discourse.group/t/sign-document-net-function-errors/2384/4 "2024-08-27T10:31:30Z")

</div>

did you solve it?  
passing csrResult.Csr, csrResult.PrivateKey as is? or change something?

---

<div class="post-metadata">

**Author:** ![eCloud](https://dub1.discourse-cdn.com/flex013/user_avatar/zatca1.discourse.group/ecloud/32/629_2.png) [@eCloud](https://zatca1.discourse.group/u/eCloud)\
**Post date:** [August 28, 2024, 11:00am UTC](https://zatca1.discourse.group/t/sign-document-net-function-errors/2384/5 "2024-08-28T11:00:55Z")

</div>

Dear @khaledmaqtari

Actually I didn’t use Zatca SDK in my Project, I just tried it and it worked. Maybe you can get an Idea how to use SDK in your project from the following image.

 ![image](https://europe1.discourse-cdn.com/flex013/uploads/zatca1/original/1X/080997b09a2ef3b545c6ce7f404a5e2515f3fed0.png)

---

<div class="post-metadata">

**Author:** ![khaledmaqtari](https://avatars.discourse-cdn.com/v4/letter/k/d6d6ee/32.png) [@khaledmaqtari](https://zatca1.discourse.group/u/khaledmaqtari)\
**Post date:** [August 29, 2024, 4:54pm UTC](https://zatca1.discourse.group/t/sign-document-net-function-errors/2384/6 "2024-08-29T16:54:34Z")

</div>

Thank you Mr @eCloud for your support.

Currently that problem solved but now I countered with I new problem  
It is about why B2B cleared but B2C only reported in sandbox invoice compliance.  
But failed in sandbox single reporting and simulation compliance.  
It’s error is: `"Invalid signed properties hashing, SignedProperties with id='xadesSignedProperties'"`  
If you have any idea check my post [here](https://zatca1.discourse.group/t/b2b-cleared-but-b2c-semi-reported/2685) , please.

---

<div class="post-metadata">

**Author:** ![alroaini2030](https://avatars.discourse-cdn.com/v4/letter/a/e495f1/32.png) [@alroaini2030](https://zatca1.discourse.group/u/alroaini2030)\
**Post date:** [August 30, 2024, 1:28pm UTC](https://zatca1.discourse.group/t/sign-document-net-function-errors/2384/7 "2024-08-30T13:28:36Z")

</div>

Thank you Can you give me a cleaninvoice.xml format before I sign?

---

<div class="post-metadata">

**Author:** ![alroaini2030](https://avatars.discourse-cdn.com/v4/letter/a/e495f1/32.png) [@alroaini2030](https://zatca1.discourse.group/u/alroaini2030)\
**Post date:** [August 30, 2024, 1:29pm UTC](https://zatca1.discourse.group/t/sign-document-net-function-errors/2384/8 "2024-08-30T13:29:39Z")

</div>

[Error] Parsing EInvoice Certificate[Error] Populating Signed Signature Properties[Error] Generating EInvoice QR Code

---

<div class="post-metadata">

**Author:** ![alroaini2030](https://avatars.discourse-cdn.com/v4/letter/a/e495f1/32.png) [@alroaini2030](https://zatca1.discourse.group/u/alroaini2030)\
**Post date:** [August 30, 2024, 2:09pm UTC](https://zatca1.discourse.group/t/sign-document-net-function-errors/2384/10 "2024-08-30T14:09:42Z")

</div>

khaledmaqtari Could you help me with the solution? I would be grateful to you

[Error] Parsing EInvoice Certificate[Error] Populating Signed Signature Properties[Error] Generating EInvoice QR Code

---

<div class="post-metadata">

**Author:** ![khaledmaqtari](https://avatars.discourse-cdn.com/v4/letter/k/d6d6ee/32.png) [@khaledmaqtari](https://zatca1.discourse.group/u/khaledmaqtari)\
**Post date:** [August 30, 2024, 3:41pm UTC](https://zatca1.discourse.group/t/sign-document-net-function-errors/2384/11 "2024-08-30T15:41:14Z")

</div>

Hello @alroaini2030  
Actually that old error was because the structure of my own xml invoice.  
So, I used the example xml invoices that come with zatca SDK

If you haven’t yet download it may you download it form [here](https://zatca.gov.sa/ar/E-Invoicing/SystemsDevelopers/ComplianceEnablementToolbox/Pages/DownloadSDK.aspx)  
Then you will find the example files in the path ends with: \Data\Samples

For doing your signing you can use that SDK Fatoora CLI command (Java) or .Net libraries -Readme files inside the folder \Readme will help you how to do it.  
Or you can use your won code by following [SigningProcessUpdated.pdf](https://zatca1.discourse.group/uploads/short-url/b4kLmEjVf0VIx81thKX33X4tc43.pdf)

---

<div class="post-metadata">

**Author:** ![themasdev](https://avatars.discourse-cdn.com/v4/letter/t/b9e5f3/32.png) [@themasdev](https://zatca1.discourse.group/u/themasdev)\
**Post date:** [September 7, 2024, 5:07pm UTC](https://zatca1.discourse.group/t/sign-document-net-function-errors/2384/12 "2024-09-07T17:07:10Z")

</div>

can you please share the project it not working for me

---

<div class="post-metadata">

**Author:** ![eCloud](https://dub1.discourse-cdn.com/flex013/user_avatar/zatca1.discourse.group/ecloud/32/629_2.png) [@eCloud](https://zatca1.discourse.group/u/eCloud)\
**Post date:** [September 8, 2024, 9:50am UTC](https://zatca1.discourse.group/t/sign-document-net-function-errors/2384/13 "2024-09-08T09:50:39Z")

</div>

For Signing Invoice, you just need copy Data folder from SDK to your Project Folder. And add Project Reference from \zatca-einvoicing-sdk-238-R3.3.4\Lib\Dot-Net8\DLL\Zatca.EInvoice.SDK\net8.0

From my picture above it shows me Invoice Signed Successfully. but signed Invoice Generated with that code does not PASS Validation.

I have finished with all the process [here](https://github.com/mabaega/ZatcaEGS) without SDK .

I want to try using .Net SDK because SDK has a feature for Invoice validation, but I also failed to use it.

So I’m also waiting for someone to share some working code using the .NET SDK.

---

<div class="post-metadata">

**Author:** ![themasdev](https://avatars.discourse-cdn.com/v4/letter/t/b9e5f3/32.png) [@themasdev](https://zatca1.discourse.group/u/themasdev)\
**Post date:** [September 8, 2024, 2:53pm UTC](https://zatca1.discourse.group/t/sign-document-net-function-errors/2384/14 "2024-09-08T14:53:50Z")

</div>

when i add Project Reference from \zatca-einvoicing-sdk-238-R3.3.4\Lib\Dot-Net8\DLL\Zatca.EInvoice.SDK\net8.0

not working this is the error msg  
(Severity Code Description Project File Line Suppression State Details  
Error (active) CS1705 Assembly ‘Zatca.EInvoice.SDK’ with identity ‘Zatca.EInvoice.SDK, Version=3.3.4.0, Culture=neutral, PublicKeyToken=cf541c52f43eaadd’ uses ‘System.Xml.ReaderWriter, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’ which has a higher version than referenced assembly ‘System.Xml.ReaderWriter’ with identity ‘System.Xml.ReaderWriter, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’ ConsoleApp2 D:\الملفات\سطح المكتب\ConsoleApp2\ConsoleApp2\CSC 1   
)

 ![لقطة الشاشة 2024-09-08 175326](https://europe1.discourse-cdn.com/flex013/uploads/zatca1/original/1X/299e37a3f9fef0c106d39cf66919d6576967e261.jpeg)

---

<div class="post-metadata">

**Author:** ![eCloud](https://dub1.discourse-cdn.com/flex013/user_avatar/zatca1.discourse.group/ecloud/32/629_2.png) [@eCloud](https://zatca1.discourse.group/u/eCloud)\
**Post date:** [September 8, 2024, 4:02pm UTC](https://zatca1.discourse.group/t/sign-document-net-function-errors/2384/15 "2024-09-08T16:02:30Z")

</div>

Make sure you add the SDK Library according to the Project Target Framework you created. Look in this folder `zatca-einvoicing-sdk-238-R3.3.4\Lib\Dot-Net8\DLL\Zatca.EInvoice.SDK`

Net Core 3.1, NetFramework 4.8 or .Net 8

---

<div class="post-metadata">

**Author:** ![themasdev](https://avatars.discourse-cdn.com/v4/letter/t/b9e5f3/32.png) [@themasdev](https://zatca1.discourse.group/u/themasdev)\
**Post date:** [September 8, 2024, 4:08pm UTC](https://zatca1.discourse.group/t/sign-document-net-function-errors/2384/16 "2024-09-08T16:08:13Z")

</div>

i copy zatca dll from 48 folder and it work but there is problem in signing its valid and not pass with cmd  
fatooraNet sign -invoice c:\test\bassam.xml -signedInvoice c:\test\bas.xml

 ![with dll](https://europe1.discourse-cdn.com/flex013/uploads/zatca1/original/1X/aedba1e560bd5a551de246a48a805b44478f7f0d.jpeg)  
 ![with fatooraNet.exe](https://europe1.discourse-cdn.com/flex013/uploads/zatca1/original/1X/dfa5608fe3e8419f0710592a0c4bd24ec08f0f2a.jpeg)

the file pass  
with dll not pass
