Type Initializer for ' ' threw an exception

I am setup on a trial for GroupDocs Viewer application and I cannot seem to get it to work. I get an exception mentioned in the subject of this post. Below is my code. It is important to note that this is a .Net Core website that is using WebAPI to call a .Net Framework 4.7.1 project which is where the GroupDocs code below is coming from.

The exception gets thrown at the line: List pages = htmlHandler.GetPages(guid, options);

License lic = new License(); lic.SetLicense(@"C:\Q2Attachments\GroupDocs.Total.lic");
        ViewerConfig config = new ViewerConfig();
        //set the storage path
        config.StoragePath = @"C:\Q2Attachments\FileAttachments\2017\11\";
        config.CachePath = @"C:\Q2Attachments\FileAttachments\2017\11\";
        config.CacheFolderName = "Cache";
        config.UseCache = false;

        ViewerHtmlHandler htmlHandler = new ViewerHtmlHandler(config);

        // Guid implies that unique document name 
        string guid = $"{config.StoragePath}1ba42029-fa9a-4e4f-b9f4-91d26723e158.pdf";

        //Instantiate the HtmlOptions object
        HtmlOptions options = new HtmlOptions();

        //to get html representations of pages with embedded resources
        options.IsResourcesEmbedded = true;

        //Get document pages in html form
        List<PageHtml> pages = htmlHandler.GetPages(guid, options);
        List<HtmlInfo> contents = new List<HtmlInfo>();

        foreach (PageHtml page in pages)
        {
            HtmlInfo htmlInfo = new HtmlInfo();
            htmlInfo.HtmlContent = page.HtmlContent;
            htmlInfo.PageNmber = page.PageNumber;
            contents.Add(htmlInfo);
        }

@keith.lewis,

Thanks for taking interest in GroupDocs.Viewer for .NET. Would you please tell us the version of GroupDocs.Viewer for .NET you are using at your end? Furthermore, please share with us the problematic document in case you are getting the exception for a specific document or file format. We look forward to hearing from you.

It is not document specific. I think it has to do with .Net Core. I created a separate Web API project using .Net Framework 4.7.1 and use it to get the documents and it works correctly. I think using .Net Core to call a .Net Framework assembly doesn’t exactly work. I am using version 17.6.0.0

@keith.lewis,

Thanks for your detailed response. In that case, would you please check and share the details of the exception? You can also catch the exception and check the Exception.InnerException property to see the error that caused the exception. We look forward to your response.