This is a migrated thread and some comments may be shown as answers.

The type initializer for 'Telerik.Windows.Documents.Fixed.Model.Fonts.FontRepository' threw an exception

2 Answers 651 Views
PdfProcessing
This is a migrated thread and some comments may be shown as answers.
gulmay
Top achievements
Rank 1
gulmay asked on 05 Nov 2014, 07:13 PM
Hello, I wonder if you can help with my issue.

In short, I am getting the exception (as in the post's title) when I get to the following line of code:


document = new RadFixedDocument();

RadFixedPage page = document.Pages.AddPage();
                
editor = new FixedContentEditor(page); // <<-- exception here



The things to note are:

1. No exception is thrown when the project is run from Visual Studio.

2. The exception is thrown when the merged assembly is run, that is after it has been merged with ILMerge.

3. The merging worked fine UNTIL I have added the Telerik.WinControls.PdfViewer.dll (and the related Telerik.Windows.Documents.Core.dll and  Telerik.Windows.Documents.Fixed) assemblies to ILMerge script and then tried to instantiate the FixedContentEditor when executing the merged assembly. 

That is, I have been using ILMerge for months with over 20 merged Telerik assemblies--no problem! It's only now that I started instantiating the FixedContentEditor so I assume it is the merged Telerik.Windows.Documents.Fixed.dll assembly that's throwing a wobbly somewhere.

By the way, the ILMerge throws no errors or warnings and the merging completes just fine. When I then run the merged assembly, it runs fine until I access the function that executes the code snipped above (that is, all other Telerik controls render correctly, etc.).

This seems to indicates it is not an issue with the ILMerge process per se. I wonder if there are some weird WPF dependencies somewhere. Even though it is a WinForms project and according to the Telerik documentation the FixedContentEditor can be used in WinForm applications, I noticed I had to refer to WindowsBase.dll in the project references because of two silly lines of code which refer to the System.Windows.Size struct.

    maxWidth = page.Size.Width - defaultLeftIndent * 2;   <<-- does not compile without WindowsBase.dll reference add
     maxHeight = page.Size.Height - currentTopOffset * 2; <<-- does not compile without WindowsBase.dll reference add



I have attached the merge script below and also screenshots my project references and successfully completed ILMerge process.

Thank you!

-----------------
merge.bat below


ilmerge /target:winexe /out:F:\OFFLINE\GULMAY\VMP1_Pro\Setup\VMP2.exe /targetplatform:"v4, C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0" F:\OFFLINE\GULMAY\VMP1_Pro\VMP1Pro\VMP1Pro\bin\Release\VMP2.exe TelerikCommon.dll Telerik.WinControls.UI.dll Telerik.WinControls.dll Telerik.WinControls.Themes.Windows7.dll Telerik.WinControls.Themes.VisualStudio2012Light.dll Telerik.WinControls.Themes.VisualStudio2012Dark.dll  Telerik.WinControls.Themes.TelerikMetroBlue.dll Telerik.WinControls.Themes.TelerikMetro.dll Telerik.WinControls.Themes.Office2013Light.dll Telerik.WinControls.Themes.Office2013Dark.dll Telerik.WinControls.Themes.Office2010Silver.dll Telerik.WinControls.Themes.Office2010Blue.dll  Telerik.WinControls.Themes.HighContrastBlack.dll Telerik.WinControls.Themes.Desert.dll Telerik.WinControls.Themes.Breeze.dll Telerik.WinControls.Themes.Aqua.dll Telerik.WinControls.GridView.dll Telerik.Windows.Documents.Core.dll Telerik.Windows.Documents.Fixed.dll Telerik.Windows.Zip.dll Telerik.WinControls.PdfViewer.dll 











2 Answers, 1 is accepted

Sort by
0
Ralitsa
Telerik team
answered on 07 Nov 2014, 02:20 PM
Hi John,

Thank you for contacting us. 

This is known issue in version Q2 2014 SP1 (2014.2.715). In Q3 2014 the PDFProcessing library moved from CTP to Beta and the issue was fixed. You can upgrade to our latest version to avoid it. 

I attached my sample demo project and video which demonstrates you the behavior in both versions. 

Should you have further questions, I would be glad to help. 

Regards,
Ralitsa
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
gulmay
Top achievements
Rank 1
answered on 07 Nov 2014, 03:36 PM
Thank you very much for very quick response.

I am sorry for "double posting", I am new to Telerik support and I was not sure if the forum was given the same priority as the support tickets, etc. In the future, I will use just one channel.

So thank you for your reply--it seems that this will solve my problem.  (I will try over the weekend and report back if there are any issues).
Tags
PdfProcessing
Asked by
gulmay
Top achievements
Rank 1
Answers by
Ralitsa
Telerik team
gulmay
Top achievements
Rank 1
Share this question
or