The type UserReportBook cannot be loaded
Environment
Product | Progress® Telerik® Reporting |
Version | 18.2.24.924 |
Description
After installing version 18.2.24.924
of Telerik Reporting, an exception occurs when trying to open a Report Book in the Standalone Report Designer or a custom application. The error message indicates that the reporting engine prevents loading types not listed as trusted or essentially needed.
Cause
The issue is due to type restriction changes introduced in Telerik Reporting version 18.2.24.924
. These changes enhance application security by preventing the loading of untrusted or unnecessary types - Type Restrictions in Telerik Reporting.
Error Message
Telerik.Reporting.Utils.TypePermissionException: The type "Telerik.Reporting.UserReportBook" contained in assembly "Telerik.Reporting, Version=18.2.24.924, Culture=neutral, PublicKeyToken=a9d7983dfcc261be" cannot be loaded.
To help improve the application's security, the reporting engine prevents loading types that are not essentially needed or listed as trusted by the user. If you consider particular types or assemblies as trusted include them in the corresponding TypeReferences or AssemblyReferences element of the 'Telerik.Reporting' configuration section in the application's configuration file.
at Telerik.Reporting.TypeValidation.TypeValidator.ValidateSerializationType(Type type)
at Telerik.Reporting.TypeValidation.SafeActivator.CreateInstanceSafe(Type type, Object[] parameters)
at Telerik.ReportDesigner.Packages.ReportDesigner.Serialization.ComponentActivator.CreateInstance(IDesignerHost host, Type type, String name, IConvertersContainer converters)
at Telerik.ReportDesigner.Packages.ReportDesigner.Serialization.ReportXmlSerializer.ObjectXmlHostReader.CreateInstance(Type type, String name)
at Telerik.Reporting.Serialization.ObjectReader.CreateInstance(Type type)
at Telerik.Reporting.Serialization.ObjectReader.ReadObject(Type type)
at Telerik.Reporting.Serialization.ObjectReader.ReadXmlElement(String name)
at Telerik.Reporting.Serialization.ObjectReader.Deserialize(IResourceHandler handler)
at Telerik.Reporting.XmlSerialization.XmlSerializerBase.Deserialize(XmlReader reader, IResourceHandler resourceHandler)
at Telerik.Reporting.XmlSerialization.XmlSerializerBase.Deserialize(Stream stream, IResourceHandler resourceHandler)
at Telerik.ReportDesigner.Packages.ReportDesigner.Serialization.ReportXmlSerializer.Deserialize(Stream stream, IResourceHandler resourceHandler)
at Telerik.Reporting.ReportPackager.UnpackageDocument(Stream packageStream)
at Telerik.ReportDesigner.Packages.ReportDesigner.Serialization.PackageDocDataHandler.DeserializeReportDocument(IDesignerLoaderHost targetHost)
at Telerik.ReportDesigner.Packages.ReportDesigner.Serialization.PackageDocDataHandler.UploadReportDocument(IDesignerLoaderHost targetHost)
at Telerik.ReportDesigner.Packages.ReportDesigner.Serialization.DocData.UploadReportDocument(IDesignerLoaderHost host)
at Telerik.ReportDesigner.Packages.ReportDesigner.Serialization.ReportDocumentDesignerLoader.PerformLoad(IDesignerSerializationManager serializationManager)
Solution
To resolve this issue and use Report Books with version 18.2.24.924
, register the type Telerik.Reporting.UserReportBook
from the Telerik.Reporting
assembly in the typeReferences element in the configuration file of the project (e.g., appsettings.json
, App.config
, Web.config
).
"telerikReporting": {
"typeReferences": [
{
"typeName": "Telerik.Reporting.UserReportBook",
"assemblyName": "Telerik.Reporting",
"publicKeyToken": "a9d7983dfcc261be"
}
]
}
<configuration>
<configSections>
<section name="Telerik.Reporting" type="Telerik.Reporting.Configuration.ReportingConfigurationSection, Telerik.Reporting" allowLocation="true" allowDefinition="Everywhere" />
</configSections>
<Telerik.Reporting>
<TypeReferences>
<add typeName="Telerik.Reporting.UserReportBook" assemblyName="Telerik.Reporting" publicKeyToken="a9d7983dfcc261be" />
</TypeReferences>
</Telerik.Reporting>
</configuration>
This configuration explicitly declares the Telerik.Reporting.UserReportBook
type as trusted, allowing the Telerik Reporting engine to load it without triggering the security exception.
If the exception occurs when opening the Report Book within the Standalone Report Designer, register the type in its
.config
file which is in the same directory as the executable.