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

LoaderException exporting pdf report from web page

6 Answers 260 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Tom
Top achievements
Rank 1
Tom asked on 19 Oct 2009, 02:40 AM

I have a very simple report (a blank one actually with a title) that I am trying to export as a pdf file. If I run it from a console app with the same code, then it creates the pdf file correctly. If I try it from within a web page it crashes. Same report works fine in development from a web page, just in production it doesnt work.

Its obviously looking for something, but I cant work out what.

Anyone have any idea what could be missing?

The bin folder for the web app includes Telerik.Reporting.dll, as well as Telerik.ReportViewer.WebForms.dll just in case.

The stack trace is:

Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.   
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.   
 
Exception Details: System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.  
 
Source Error:   
 
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.    
 
Stack Trace:   
 
 
[ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.]  
   System.Reflection.Module._GetTypesInternal(StackCrawlMark& stackMark) +0  
   System.Reflection.Assembly.GetTypes() +105  
   Telerik.Reporting.Processing.Expressions.NameSpaceResolver.Resolve(Assembly assembly) +14  
   Telerik.Reporting.Processing.Expressions.ExpressionContext.ResolveNameSpaces() +97  
   Telerik.Reporting.Processing.Expressions.ExpressionContext..ctor(Type methodInfoSourceType) +159  
   Telerik.Reporting.Processing.ReportProcessor.ProcessReport(IReportDocument reportDocument, String& documentName) +67  
   Telerik.Reporting.Processing.ReportProcessor.RenderReport(String format, IReportDocument reportDocument, Hashtable deviceInfo, CreateStream createStreamCallback, String& documentName) +263  
   Telerik.Reporting.Processing.ReportProcessor.RenderReport(String format, IReportDocument reportDocument, Hashtable deviceInfo) +108  
   CCConnect.TestPage.TestButton_Click(Object sender, EventArgs e) +197  
   System.Web.UI.WebControls.LinkButton.OnClick(EventArgs e) +111  
   System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument) +79  
   System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10  
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13  
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +175  
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565  
 
   
 
 
--------------------------------------------------------------------------------  
Version Information: Microsoft .NET Framework Version:2.0.50727.3053; ASP.NET Version:2.0.50727.3053  

The simple code is:

        protected void TestButton_Click(object sender, EventArgs e)  
        {  
            TestReport r = new TestReport();  
            Hashtable deviceInfo = new Hashtable();  
            deviceInfo["FontEmbedding"] = "Subset";  
            Telerik.Reporting.Processing.ReportProcessor RP = new Telerik.Reporting.Processing.ReportProcessor();  
            byte[] buffer = RP.RenderReport("PDF", r, deviceInfo).DocumentBytes;  
 
            string myPath = Properties.Settings.Default.MerchantRequestLocalPath;  
            string pdfFile = myPath + @"\" + DateTime.Now.ToString("HHmmss") + ".pdf";  
            FileStream fs = new FileStream(pdfFile, FileMode.Create);  
 
            fs.Write(buffer, 0, buffer.Length);  
            fs.Flush();  
            fs.Close();  
 

6 Answers, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 19 Oct 2009, 08:57 AM
Hi Tom,

If you're hosting under Medium trust environment, please have the following article in mind: Medium Trust Support.

Greetings,
Steve
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Tom
Top achievements
Rank 1
answered on 22 Oct 2009, 08:20 AM
Hi Steve,

Thanks for your reply. I thought I responded to this the other day but cant see my response here - must have got lost.

In any case, the problem got more and more strange, to the point where I had both the test and live pages running in the same web app, one working and one not.

But then I noticed there was a new version sp1 that apparently I hadn't installed. This appears to have fixed it. So thanks for your help.

Tom
0
Rob
Top achievements
Rank 1
answered on 27 Jan 2011, 02:38 PM
We have the same problem in a web application. We're using the 2.9.9.202 version of telerik reporting.
It has worked before, but with a new release of our application we are now getting this error on a production server..
Security or dotnet version has not changed on the IIS server. I already have cleaned up the temporary asp.net files.
Are there any steps to resolve the cause of this error ?

Best regards
Rob

Timestamp: 1/27/2011 1:26:29 PM Message: HandlingInstanceID: 42f2594b-c307-4f5e-8f3e-b4c27da3fd8d  An exception of type 'System.Reflection.ReflectionTypeLoadException' occurred and was caught.  ---------------------------------------------------------------------------------------------  01/27/2011 14:26:28  Type : System.Reflection.ReflectionTypeLoadException, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089  Message : Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.  Source : mscorlib  Help link :   Types : System.Type[]  LoaderExceptions : System.Exception[]  Data : System.Collections.ListDictionaryInternal  TargetSite : System.Type[] _GetTypesInternal(System.Threading.StackCrawlMark ByRef)  Stack Trace :    at System.Reflection.Module._GetTypesInternal(StackCrawlMark& stackMark)     at System.Reflection.Assembly.GetTypes()     at Telerik.Reporting.Processing.Expressions.NameSpaceResolver.Resolve(Assembly assembly)     at Telerik.Reporting.Processing.Expressions.ExpressionContext.ResolveNameSpaces()     at Telerik.Reporting.Processing.Expressions.ExpressionContext..ctor(Report report)     at Telerik.Reporting.Processing.Report..ctor(ReportItemBase itemDefinition)     at Telerik.Reporting.Processing.ItemFactory.CreateItem(ReportItemBase itemDef)     at Telerik.Reporting.Processing.ReportProcessor.ProcessReport(Report reportDefinition)     at Telerik.Reporting.Processing.ReportProcessor.Render(String format, Report report, Hashtable deviceInfo, CreateStream createStreamCallback, String& documentName)     at Telerik.Reporting.Processing.ReportProcessor.Render(String format, Report report, Hashtable deviceInfo, String& mimeType, String& documentName, String& extension, Encoding& encoding)     at Telerik.Reporting.Processing.ReportProcessor.Render(String format, Report report, Hashtable deviceInfo, String& mimeType, String& extension, Encoding& encoding)     at FHG.PPCP.BusinessLayer.TelerikReportGenerator.Export(Stream stream)     at FHG.PPCP.Web.WebServices.GenerateQuickReport()    Additional Info:    MachineName : ABC TimeStamp : 1/27/2011 1:26:28 PM FullName : Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 AppDomainName : /LM/W3SVC/1641019652/Root-1-129406083197550482 ThreadIdentity : user@abc.com WindowsIdentity : NT AUTHORITY\NETWORK SERVICE  Category: Exception Priority: 0 EventId: 100 Severity: Error Title:Silent User Interface Exception Machine: FHGPPOA7 Application Domain: /LM/W3SVC/1641019652/Root-1-129406083197550482 Process Id: 4948 Process Name: c:\windows\system32\inetsrv\w3wp.exe Win32 Thread Id: 4744 Thread Name:  Extended Properties: 
0
Steve
Telerik team
answered on 28 Jan 2011, 01:34 PM
Hi Rob,

This thread is pretty old, but according to Tom's last reply, the problem disappeared after upgrading to a more recent version (I would assume of our product). However since you claim this project works in your dev environment, it could be Tom installed a service pack of the .NET framework. These are all guesses, but if this is an issue with our product, our suggestion would be upgrading to a more recent version.

Best wishes,
Steve
the Telerik team
Get started with Telerik Reporting with numerous videos and detailed documentation.
0
Tom
Top achievements
Rank 1
answered on 30 Jan 2011, 10:46 PM
Hi Rob & Steve,

Yes, it was a while ago, and I cant quite remember what it was either. I think what I did was look closely assembly versions of the telerik assemblies in the bin folder, and found that on that particular machine theywere not the latest version.

Hope thats a pointer in the right direction anyway.

Tom
0
Rob
Top achievements
Rank 1
answered on 02 Feb 2011, 02:11 PM
Thanks for the answers.

I have checked the assembly versions of the 3 dll's we are using, but they are all equal on the dev environment and production system
Telerik.Reporting 2.9.9.202
Telerik.Rporting.Processing 2.9.9.202
Telerik.Web.UI 2008.3.1314.35

upgrading is not a option because the theming of the web application will break (according to the previous developer)

I don't understand why a restore (putting back) of an older version of the web application also has the same problem now.
Look like a dll problem. (I also cleaned the .net framework dll cache)

Best regards
Rob
Tags
General Discussions
Asked by
Tom
Top achievements
Rank 1
Answers by
Steve
Telerik team
Tom
Top achievements
Rank 1
Rob
Top achievements
Rank 1
Share this question
or