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

Free Support Forum - aspose.com

Object reference error

hey

i have this code when “ann” is annotation entity on crm dynamics, i get the document as byte array :

documentContent = Encoding.UTF8.GetBytes(ann.DocumentBody);
MemoryStream newStream = new MemoryStream(documentContent);
newStream.Seek(0, SeekOrigin.Begin);
Document wordDoc = new Document(newStream);

it failes on this line :

Document wordDoc = new Document(newStream);

STACK TRACE:
" at Aspose.Words.Document.\u0003(Stream \u0002, LoadOptions \u0003)\r\n at Aspose.Words.Document.\u0002(Stream \u0002, LoadOptions \u0003)\r\n at Aspose.Words.Document…ctor(Stream stream, LoadOptions loadOptions)\r\n at Aspose.Words.Document…ctor(Stream stream)\r\n at Edu.Syt.Crm.CustomWorkflows.ProduceDocument.ConvertToPdf(CrmContext context, Annotation ann)\r\n at Edu.Syt.Crm.CustomWorkflows.ProduceDocument.AttachDocToRequest(CrmContext context, IOrganizationService service, EntityReference ent, DocumentTemplate doc)\r\n at Edu.Syt.Crm.CustomWorkflows.ProduceDocument.ExecuteWorkflow(LocalWorkflowContext executionContext)\r\n at CommonCWF.CustomWorkflow.Execute(CodeActivityContext executionContext)"

MASSAGE:
“yC\u001cz^qé\u001c@N\u0017.\u001a\u007fú\u0019HJ\v)\u001ajåIONY9Ulø\u001c]_\u001c>\u001a\u007fä\r\rH\u00184TqþIONY6U\u007fî\fI\u0005”

also if i write this line Document doc = new Document();

it also failed with this error :

2146233036
{“Culture is not supported.\r\nParameter name: name\r\nHET4@ is an invalid culture identifier.”}
Hi there,

orielfa:
hey
i have this code when "ann" is annotation entity on crm dynamics, i get the document as byte array :

documentContent = Encoding.UTF8.GetBytes(ann.DocumentBody);
MemoryStream newStream = new MemoryStream(documentContent);
newStream.Seek(0, SeekOrigin.Begin);
Document wordDoc = new Document(newStream);

it failes on this line :

Document wordDoc = new Document(newStream);

STACK TRACE:
" at Aspose.Words.Document.\u0003(Stream \u0002, LoadOptions \u0003)\r\n at Aspose.Words.Document.\u0002(Stream \u0002, LoadOptions \u0003)\r\n at Aspose.Words.Document..ctor(Stream stream, LoadOptions loadOptions)\r\n at Aspose.Words.Document..ctor(Stream stream)\r\n at Edu.Syt.Crm.CustomWorkflows.ProduceDocument.ConvertToPdf(CrmContext context, Annotation ann)\r\n at Edu.Syt.Crm.CustomWorkflows.ProduceDocument.AttachDocToRequest(CrmContext context, IOrganizationService service, EntityReference ent, DocumentTemplate doc)\r\n at Edu.Syt.Crm.CustomWorkflows.ProduceDocument.ExecuteWorkflow(LocalWorkflowContext executionContext)\r\n at CommonCWF.CustomWorkflow.Execute(CodeActivityContext executionContext)"

MASSAGE:
"yC\u001cz^qé\u001c@N\u0017.\u001a\u007fú\u0019HJ\v)\u001ajåIONY9Ulø\u001c]_\u001c>\u001a\u007fä\r\rH\u00184TqþIONY6U\u007fî\fI\u0005"

Thanks for your inquiry. We will appreciate it if you please share your input document here. We will look into it and will guide you accordingly. Furthermore, you can save your input stream to file to double check the input document.

Best Regards,
Hi there,

orielfa:
also if i write this line Document doc = new Document();
it also failed with this error :

2146233036
{"Culture is not supported.\r\nParameter name: name\r\nHET4@ is an invalid culture identifier."}

Thanks for your inquiry. Please share a sample console application along with your environment details. We will try to replicate the issue at our end and will guide you accordingly.

We are sorry for the inconvenience.

Best Regards,

what enviroment details you need?

when i ran this line :


Document doc = new Document();

on cosole app it works fine , but when i run the same line from Custom workflow (crm dynamics) it gives the above error about the culture is not supported , any idea ?
Hi there,

Thanks for your feedback. Please confirm which CRM Version you are using? This is a generic error which may be caused due to many reasons. We doubt that you have not registered the plugin correctly on your CRM. Please try using Microsoft recommended Plugin Registration tool.

Furthermore, please do not use sandbox while attaching the plugin to annotation entity. Aspose documents require disk space and sandbox plugins do not allow any outside communication like Upload/Download files.

Best Regards,

i am using crm365 on permises ,


what plugin? i downloaded aspose.words and added the dll to my customworkflow project , i didn’t download aspose plugin

Hi there,

Thanks for your feedback. Aspose.Words for .NET DLL is supported with CRM 365. Please confirm how do you attach the custom workflow with CRM? Furthermore, please also share your CRM target .NET Framework version. Please note if you are using .NET Core Framework as target .NET Framework of your CRM then it will not work. As currently Aspose.Words does not support .NET Core Framework.

We are sorry for the inconvenience.

Best Regards,

i attached the CWF from plugin regiesterion tool , the cwf for himself work good.


i am using .net 4.5.2.

is the user that runs the CWF need some kind of permission to something?
Hi there,

Thanks for your feedback. Please note if Custom Workflow is working good then the usage of Aspose.Words DLL is not correct. Because, Aspose.Words DLL is strongly secured and cannot be merged with any other assembly.

Pease try using the following steps and see how it goes on your end.

1. Register the workflow via plugin registration tool under "None" isolation instead of "Sandbox"
2. Store the workflow in disk instead of Database
3. Copy Aspose.Words DLL under bin in your CRM web installed directory or register it in GAC

Best Regards,