1.50 beta 4 - Simplest WPF program instantly crashes but does not in beta3
------------------------------------------------------------------------------------------
The simplest WPF program creates a valid PDF but crashes after that without throwing an exception.
• VS2015
• New project ‘WPF Application’
• NuGet: PDFsharp-MigraDoc-wpf v1.50.4589-beta4
• .NET 4.5.2 (doesn’t actually matter, same with 4.6)
• Add simple button
• Add the following code
Code:
private void button_Click(object sender, RoutedEventArgs e)
{
try
{
var document = new Document();
var section = document.AddSection();
section.AddParagraph("Hello World");
var renderer = new PdfDocumentRenderer();
renderer.Document = document;
renderer.RenderDocument();
// ... save to PDFfile here ...
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString(), "Exception ...");
}
}
• Run
• Program crashes and doesn’t even hit the catch block
• If you would save the document, you would get a valid PDF file but it crashes after that anyway (I left that code out for simplicity)
• Revert to beta3
• NuGet: PDFsharp-MigraDoc-wpf v1.50.4000-beta3
• Compile and Run
• No crash
If the experts could have a look, Many Thanks!
(+ Many thanks for sharing the project!)