Converting OneNote to HTML fails on certain machine in .NET

Hi,

I need help with a conversion problem with GroupDocs.Viewer 21.8 that only happens on a certain machine.
It seems to happen with any .one file that we tested.
The exception points to a problem with fonts. Is there any way to do further analysis of this problem?
Quick Notes.zip (278.5 KB)

Since the callstack mentioned “ViewInfoOptions”, those are the options we’re setting:

        var htmlViewOpts = ViewOpts.HtmlViewOptions.ForEmbeddedResources();
        var viewOptions = ViewInfoOptions.FromHtmlViewOptions(htmlViewOpts);
        viewOptions.EmailOptions.PageSize = ViewOpts.PageSize.A4;
        viewOptions.RenderComments = false;
        viewOptions.CadOptions.RenderLayouts = true;
        viewOptions.SpreadsheetOptions = ViewOpts.SpreadsheetOptions.ForOnePagePerSheet();
        viewOptions.SpreadsheetOptions.RenderGridLines = true;
        viewOptions.SpreadsheetOptions.RenderHeadings = true;

That’s the exception reported from our application:

The type initializer for '  ' threw an exception.
Application: TheConversionServer
Username: SYSTEM
Stack:	   at   .()
   at Aspose.Note.Page..ctor(Document document)
   at   .​     ()
   at   .​     ()
   at   .()
   at   .​     ()
   at   .(Stream , Document , LoadOptions )
   at Aspose.Note.Document.(Stream , LoadOptions )
   at Aspose.Note.Document..ctor(Stream inStream, LoadOptions loadOptions)
   at   .(Stream , LoadOptions , Boolean , String )
   at  .(Object )
   at  .(MethodBase , Boolean )
   at  . ()
   at  .(Boolean )
   at  .(Object )
   at  .()
   at  .(Object , UInt32 )
   at  .(Boolean )
   at  .(Object[] , Type[] , Type[] , Object[] )
   at   .      (LoadOptions , BaseViewOptions )
   at   .     (String , Stream , LoadOptions , BaseViewOptions )
   at GroupDocs.Viewer.Viewer.(LoadOptions , BaseViewOptions )
   at GroupDocs.Viewer.Viewer.(BaseViewOptions )
   at GroupDocs.Viewer.Viewer.(ViewInfoOptions )
...
Additional information:
	Unable to set provided font as default
Parameter name: defaultFontName

Hi @Clemens_Pestuka

I checked your one file and found this document using ‘Segoe UI Light’ font.
So it needs to exist on the machine. And what OS are you using?

1 Like

@mikhail.evgrafov.aspose

Thank you for this information.
Unfortunately our QA team could not check, because the VM was reverted and the error did not happen again.
But I’ll tell them to check the “Segoe UI Light” font if the issue should come back.

@Clemens_Pestuka

Got it, let us know if you will be experiencing the same issue.

Hi @vladimir.litvinchik,

Today the issue happened again, and I was able to verify that the font is installed on the system.
image.png (167.3 KB)

After restarting the machine, everything was working fine.
Before the restart, multiple attempts were failing, so it really is the restart that fixes it somehow.
The font was not recently installed.
Do you have an idea what else we could check?

Hi @Clemens_Pestuka

Yes, but I want to ask for some information:
What is your code? I correctly understood that you call first viewer.GetViewInfo, and then the conversion (viewer.View)?

@mikhail.evgrafov.aspose

Yes that’s correct, we always call GetViewInfo before conversion.
That’s more ore less the code we are executing:

var htmlViewOpts = HtmlViewOptions.ForEmbeddedResources();
var viewOptions = FromHtmlViewOptions(htmlViewOpts);
viewOptions.EmailOptions.PageSize = PageSize.A4;
viewOptions.RenderComments = false;
viewOptions.CadOptions.RenderLayouts = true;
viewOptions.SpreadsheetOptions = SpreadsheetOptions.ForOnePagePerSheet();
viewOptions.SpreadsheetOptions.RenderGridLines = true;
viewOptions.SpreadsheetOptions.RenderHeadings = true;

ViewOpts.LoadOptions loadOpts = new LoadOptions();
loadOpts.ResourceLoadingTimeout = TimeSpan.FromSeconds(10);

using (var viewer = new Viewer(sInputFile, loadOpts))
{
	var info = viewer.GetViewInfo(viewOptions);

            var options = HtmlViewOptions.ForEmbeddedResources(pageStreamHandler.CreateNewStream);
	options.EmailOptions.PageSize = PageSize.A4;
	options.ArchiveOptions.FileName = new FileName("");
	options.ArchiveOptions.Folder = document.FolderName;
	options.RenderComments = ConversionOptions.RenderWordComments;
	options.CadOptions.RenderLayouts = true;
	options.SpreadsheetOptions = SpreadsheetOptions.ForOnePagePerSheet();
	options.SpreadsheetOptions.RenderGridLines = true;
	options.SpreadsheetOptions.RenderHeadings = true;

	viewer.View(options, aPageNumbers);
}

Hi @Clemens_Pestuka

Thank you for your code!
I trying to reproduce your issue locally.

1 Like

@Clemens_Pestuka

I also noticed “TheGroupDocs.cpp” in your screenshot - you are using GroupDocs.Viewer inside C++ application? Can you provide more details about that? It may be significant to reproduce the issue.
It is possible to get a simple project with C++ code with GroupDocs.Viewer used (Managed code DLL wrapped in C++ native code right?)

Hi @mikhail.evgrafov.aspose,

Yes we are using GroupDocs from our C++ code.
I have attached one of my test applications that uses this structure.
AsposeManaged.zip (33.8 KB)
(Although it’s named “Aspose” it uses GroupDocs, as it wasn’t decided at this time, with which one we’ll go.)

@Clemens_Pestuka

Thank you for the quick response and sample!

Hi @Clemens_Pestuka

I need additional information:

  1. Is it a stable issue? Or it happens from time to time?
    When you get this issue, next documents will be converted again only after restart?
  2. Can you specify the environment of the app?(OS version, framework version)

Hi @mikhail.evgrafov.aspose,

  1. It issue is stable when it happens, so all conversion attempts fail until you restart.
    And after restart it’s working in a stable way, so only the restart is changing the behavior.
    We did not take a snapshot of the “not working” state so far and we did not yet figure out what it triggers.
    The VM is reverted to the “clean installation” state every night and then automatic tests are executed.

  2. It’s a Windows 2019 Server [Version 10.0.17763.2090] running on a Hyper-V server.
    We are using .NET Framework 4.7.2.

@Clemens_Pestuka

Thank you for sharing the details. We’ll try reproducing this issue. In case of any updates, we’ll let you know.

Hi @vladimir.litvinchik,

We’re closing the bug on our side, so feel free to do the same.
It’s probably related to how the machine is set up and therefore just a waste of time.

@Clemens_Pestuka

Got it, thank you for the feedback. Can you share what have you re-configured to fix this issue?

@vladimir.litvinchik

We did not fix it. It still happens sometimes, but it’s not worth further analysis.

@Clemens_Pestuka

Got it, thanks.

Hi @Clemens_Pestuka

Here is a special build of GroupDocs.Viewer 21.8 to test your issue on your environment.
Please check your issue with this build:

Hi @mikhail.evgrafov.aspose,

Thank you for the effort, but as described were not able to reproduce the issue reliably and closed it on our side. We also don’t have a checkpoint anymore to test with unfortunately, and we removed the failing test.