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

Free Support Forum - aspose.com

The type initializer for '\u000f' threw an exception

I use service to convert msg file, send error
TransferToPDF exception: System.NullReferenceException: Object reference not set to an instance of an object.
at Aspose.Html.Rendering.MhtmlRenderer.(IDevice , Configuration , TimeSpan , Stream[] )
at Aspose.Html.Rendering.MhtmlRenderer.Render(IDevice device, Stream document, Configuration configuration, TimeSpan timeout)
at Aspose.Html.Rendering.MhtmlRenderer.Render(IDevice device, Stream document, Configuration configuration)
at .( , IDevice )
at . ( , PdfSaveOptions , ICreateStreamProvider )
at Aspose.Html.Converters.Converter.ConvertMHTML(Stream stream, PdfSaveOptions options, ICreateStreamProvider provider)
at PwC.C4.Ants.Controllers.FileController.TransferToPDFByStream(String formId, String fileids, String fieldName, String pdfid, String pdfFirstPageId, String documentId, Boolean enablethumbnail, String env) in
RE Alignment on TRF - Security process review for Smart at Work hybrid APP release.zip (53.1 KB)

e “MSG”:
Aspose.Email.MailMessage msg = Aspose.Email.MailMessage.Load(fs);
Aspose.Email.Mapi.MapiMessage mapi = Aspose.Email.Mapi.MapiMessage.FromMailMessage(msg, new Aspose.Email.Mapi.MapiConversionOptions(Aspose.Email.Mapi.OutlookMessageFormat.Unicode));
MemoryStream mhtml = new MemoryStream();

                        mapi.Save(mhtml, Aspose.Email.SaveOptions.DefaultMhtml);
                        var options = new Aspose.Html.Saving.PdfSaveOptions();
                        options.PageSetup.AdjustToWidestPage = true;

                        // Create an instance of MemoryStreamProvider
                        using (var streamProvider = new MemoryStreamProvider())
                            // Convert MHTML to PDF by using the MemoryStreamProvider
                            Aspose.Html.Converters.Converter.ConvertMHTML(mhtml, options, streamProvider);

                            // Get access to the memory stream that contains the resulted data
                            var memory = streamProvider.Streams.First();
                            memory.Seek(0, System.IO.SeekOrigin.Begin);



We have tested the scenario using the Aspose.Email for .NET 22.2 and Aspose.HTML for NET 22.3. We have not found the shared issue. So, please use the latest versions of Aspose products.