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

The assembly "xxx" is not permitted to be used in an ObjectDataSource

3 Answers 696 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Scott
Top achievements
Rank 1
Scott asked on 17 Oct 2016, 09:00 PM

I get this after upgrading to the latest reporting DLL's from RC1. I know this is a breaking change according to the following:

http://www.telerik.com/support/kb/reporting/details/telerik-reporting-r3-2016---upgrade-issues-with-objectdatasource-component

but I do not know where to put the information. I've tried the app.config, web.config but I still get the message. My project is using an HTML5 viewer in a .Net Core view and I just can't quite get it to work properly.

Thank you for any assistance,

Scott

3 Answers, 1 is accepted

Sort by
0
Stef
Telerik team
answered on 18 Oct 2016, 12:46 PM
Hello Scott,

Custom configuration settings cannot be read from an XML config file, and JSON config files are not yet supported.

Please modify the ReportsControllerBase implementation (the Reporting REST service) to use a custom resolver - an example of a custom resolver. Then you can set the data items' DataSource properties to directly instantiated data objects.

A hack that can be tested is to add an APP.CONFIG (not a mistake) in the root of the project and the Telerik.Reporting section's declaration and content in it.

Regards,
Stef
Telerik by Progress
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Scott
Top achievements
Rank 1
answered on 18 Oct 2016, 02:04 PM
Thank you, Stef - with your information on the custom resolver I was able to get it to work.
0
Anatoliy
Top achievements
Rank 1
answered on 04 Aug 2017, 05:42 PM

Adding app.config to project's root level for some reason did not work for me. But ReportResolver customization did work. In ReportsController, ReportFileResolver is replaced by this custom resolver

    public ReportsController(IHostingEnvironment environment)
    {
        var reportsPath =
            Path.Combine(environment.WebRootPath, "Reports");
 
        ReportServiceConfiguration =
            new ReportServiceConfiguration
            {
                HostAppId = "FACMPPortal",
                Storage = new FileStorage(),
                ReportResolver = new CustomReportResolver(reportsPath), // new ReportFileResolver(reportsPath),
                // ReportSharingTimeout = 0,
                // ClientSessionTimeout = 15,
            };
 
    }
}

And here is the customized resolver itself. As you can see does nothing except unpackaging a report. Still this resolves "not permitted to be used" issue with an assembly.

public class CustomReportResolver : IReportResolver
    {
        public string ReportsPath { get; private set; }
 
        public CustomReportResolver(string reportsPath)
        {
            ReportsPath = reportsPath;
        }
 
        public ReportSource Resolve(string report)
        {
            var reportfile = Path.Combine(ReportsPath, report);
            Report reportInstance = null;
 
            var reportPackager = new ReportPackager();
            using (var stream = File.OpenRead(reportfile))
            {
                reportInstance = reportPackager.Unpackage(stream);
            }
 
            return new InstanceReportSource { ReportDocument = reportInstance };
        }
    }
Tags
General Discussions
Asked by
Scott
Top achievements
Rank 1
Answers by
Stef
Telerik team
Scott
Top achievements
Rank 1
Anatoliy
Top achievements
Rank 1
Share this question
or