Free Support Forum -

Assemble and view documents in a single .NET project

I have a GroupDocs.Total license. I am using GroupDocs in my web application and plan to use multiple pieces of the GroupDocs family. I have already implemented the GroupDocs.Viewer in my application and it is working well. I am now trying to implement the GroupDocs.Assembly portion to render documents from templates and I am having issues. When I was trying to get the Assembly to work I kept getting the error “{“The type initializer for '\u0003 ’ threw an exception.”}” and the inner exception is "The type initializer for ‘\u0002’ threw an exception and a message on the inner exception is “object reference not set to an instance of an object”. After battling this for a few days I discovered that If I remove the project that contains GroupDocs.Viewer the Assembly works fine and without error. I even created a new project that is very basic and added the GroupDocs.Assembly and it works perfectly fine. As soon as I add GroupDocs.Viewer (I am using nuget to bring in the reference), the application stops working even though I am not even using the GroupDocs,Viewer. Just the mere fact that I have both in one project is causing the issue. As soon as I remove the reference to the GroupDocs.Viewer then the Assembly starts working again.

How can I use multiple GroupDocs products within the same application?


Thanks for using GroupDocs products. Would you please prepare and share with us a sample console application that can be used to reproduce your mentioned behaviour of the products? We shall be looking forward to your response.

I found my issue while creating the test project. I have seperate service classes for each of the products. I have an Assembly service and a Viewer service. I was setting the license within the constructor of that service. So when I called the Assembly service it it didnt set the Viewer license. I resolved by moving all of the license setup to the Startup class instead of instantiating the license in the service constructor.


It’s good to know that your issue is resolved. In case you would have any other questions, please feel free to let us know.