GoPdfWriter Hangs in Generate method

Using Go.Pdf 5.1.0.45
Application is C# .NET 4.5
Test platform is Win 7.

The GoPdfWriter.Generate(string path) method hangs on any view that contains a pattern similar to the following:

The following code is used to export the view:

private void ExportPDF()
{
var exportAction = new Action(() =>
{
var saveFileDialog = new SaveFileDialog { DefaultExt = “pdf”, Filter = @“PDF files|*.pdf” };
if (saveFileDialog.ShowDialog() != DialogResult.OK) return;

      OnExportBegin();
      var filePath = saveFileDialog.FileName;
      var writer = new GoPdfWriter();
      writer.View = View;
      writer.RegisterStandardGenerators();

      try
      {
          writer.Generate(filePath);
          OnExportComplete(filePath);
      }
      catch (IOException ex)
      {
          ErrorLogger.Instance.Write(ErrorLevel.Error, ex.Message);
          OnExportFailed();
      }
  });

  var scheduler = TaskScheduler.FromCurrentSynchronizationContext();
  var exportTask = Task.Factory.StartNew(exportAction, CancellationToken.None, TaskCreationOptions.None, scheduler);

}

Please advise how to resolve this issue.

Thanks

Does it work without doing the separate Task?

Sorry for the delayed response, I was busy somewhere else.

The same error occurs without the separate task.
It throws an exception.(see below)

System.Collections.Generic.KeyNotFoundException was unhandled
HResult=-2146232969
Message=The given key was not present in the dictionary.
Source=PresentationCore
StackTrace:
at MS.Internal.FontCache.FontFaceLayoutInfo.IntMap.System.Collections.Generic.IDictionary<System.Int32,System.UInt16>.get_Item(Int32 i)
at Northwoods.Go.Pdf.GoPdfWriter.CidWids(List`1 CharSet, GlyphTypeface gt, UInt16& DW, Double& bl, Double& bb, Double& br, Double& bt, UInt16[]& glyphset)
at Northwoods.Go.Pdf.GoPdfWriter.finalizeFonts()
at Northwoods.Go.Pdf.GoPdfWriter.Generate(Stream stream)
at Northwoods.Go.Pdf.GoPdfWriter.Generate(String path)
at SE.ControlDatabaseMigrationTool.DiagramUserControl.Diagram.b__3b() in c:\Projects\BaileyMigration\ControlDatabaseMigrationTool\src\ControlDatabaseMigrationTool\DiagramUserControl\Diagram.cs:line 773
at SE.ControlDatabaseMigrationTool.DiagramUserControl.Diagram.ExportPDF() in c:\Projects\BaileyMigration\ControlDatabaseMigrationTool\src\ControlDatabaseMigrationTool\DiagramUserControl\Diagram.cs:line 789
at SE.ControlDatabaseMigrationTool.DiagramUserControl.Diagram.Export() in c:\Projects\BaileyMigration\ControlDatabaseMigrationTool\src\ControlDatabaseMigrationTool\DiagramUserControl\Diagram.cs:line 253
at SE.ControlDatabaseMigrationTool.UI.VisualizationUserControl.btn_ExportPDF_ItemClick(Object sender, ItemClickEventArgs e) in c:\Projects\BaileyMigration\ControlDatabaseMigrationTool\src\ControlDatabaseMigrationTool\ControlDatabaseMigrationTool_UI\VisualizationUserControl.cs:line 243
at DevExpress.XtraBars.BarItem.OnClick(BarItemLink link)
at DevExpress.XtraBars.BarBaseButtonItem.OnClick(BarItemLink link)
at DevExpress.XtraBars.BarButtonItem.OnClick(BarItemLink link)
at DevExpress.XtraBars.BarItemLink.OnLinkClick()
at DevExpress.XtraBars.BarButtonItemLink.OnLinkClick()
at DevExpress.XtraBars.BarItemLink.OnLinkAction(BarLinkAction action, Object actionArgs)
at DevExpress.XtraBars.BarButtonItemLink.OnLinkAction(BarLinkAction action, Object actionArgs)
at DevExpress.XtraBars.BarItemLink.OnLinkActionCore(BarLinkAction action, Object actionArgs)
at DevExpress.XtraBars.ViewInfo.BarSelectionInfo.ClickLink(BarItemLink link)
at DevExpress.XtraBars.ViewInfo.BarSelectionInfo.UnPressLink(BarItemLink link)
at DevExpress.XtraBars.Controls.CustomLinksControl.OnMouseUp(MouseEventArgs e)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at DevExpress.XtraBars.Controls.DockedBarControl.WndProc(Message& msg)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run()
at SE.ControlDatabaseMigrationTool.UI.Program.Main() in c:\Projects\BaileyMigration\ControlDatabaseMigrationTool\src\ControlDatabaseMigrationTool\ControlDatabaseMigrationTool_UI\Program.cs:line 25
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:

Are you specifying a font family on the port labels?

We are not AFAIK specifying font families.
However we are using skins to set the general UI look & feel.
I don’t know if that would affect the fonts used by (or made available to) your library.
The strange thing is that most diagrams export without fail when they are generated exactly the same way as the few that fail.