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

Telerik.Reporting.WebServiceDataSource cannot be resolved

5 Answers 249 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Randy
Top achievements
Rank 1
Veteran
Randy asked on 23 Dec 2020, 11:04 AM

Hi,

I'm using below code to generate report on run time:

using (ReportBook reportBook = new ReportBook())
            {
                foreach (Object input in inputValues)
                {
                    InstanceReportSource reportSource = new InstanceReportSource
                    {
                        ReportDocument = new MyReport
                        {
                            DataSource = new JsonDataSource
                            {
                                Name = "jsonDataSource1",
                                Source = genJsonDataSource(input)  // get json string from input object
                            }
                        }
                    };
                    reportBook.ReportSources.Add(reportSource);
                }
 
                ReportProcessor reportProcessor = new ReportProcessor();
                InstanceReportSource instanceReportSource = new InstanceReportSource
                {
                    ReportDocument = reportBook
                };
                RenderingResult result = reportProcessor.RenderReport("PDF", instanceReportSource, new System.Collections.Hashtable());
                // save report file from result
......
            }

 

MyReport is a c# report class created by visual studio designer. It is designed with a json datasource named "jsonDataSource1" with some sample data in it. The report is generated as PDF but error is shown as in attached screenshot. I followed the instructions in https://docs.telerik.com/reporting/knowledge-base/missing-assembly-reference-when-using-jsondatasource by referencing Telerik.Reporting.WebServiceDataSource.dll in my project and make sure it's exist in the running directory. But the error persists. And when the dll is not referenced, I can preview the report without problem. So the symptom seems not exactly same as the document describes. The dll version is 14.2.20.1021. .Net 4.8.

What else need be done to fix this error?

5 Answers, 1 is accepted

Sort by
0
Randy
Top achievements
Rank 1
Veteran
answered on 23 Dec 2020, 12:01 PM

I'm thinking the problem is because of Newtonsoft.Json.dll. The version referenced by Telerik.Reporting.WebServiceDataSource.dll is 9.0.0.0, while the one we used is 12.0.0.0. I already had bindingRedirect setting in web.config:

<dependentAssembly>
  <assemblyIdentity name="Newtonsoft.Json" culture="neutral" publicKeyToken="30ad4fe6b2a6aeed" />
  <bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
</dependentAssembly>

 

But seems no help. I cannot lower the file version as it is used by many other projects. How to solve this conflict?

0
Dimitar
Telerik team
answered on 23 Dec 2020, 04:22 PM

Hi Randy,

I have already replied to you in the ticket however I will also copy the answer in this forum thread and would like to suggest continuing the discussion here so that members of the community can benefit from the information too.

I have tested locally to display and export a report pdf with Newtonsoft version 12.0.0.0 and it is working on my end. I will attach a silent video to my reply as proof.

There are two Telerik.Reporting.WebServiceDataSource.dll files, one for .NET Standard 2.0 and one for .NET 4.0. Could you specify which one you tried referencing? 

The best way to make sure you reference the correct one is by installing it from the NuGet package manager. Please install version 14.2.20.1021 of the package and test if that solves the issue. Note, if you cannot find the Telerik.Reporting.WebServiceDataSource package, try setting the Package Source to All.

If the above information does not help fix the problem, please provide a runnable sample project that demonstrates the issue.

Looking forward to receiving an update from you.

Regards, Dimitar Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

0
Randy
Top achievements
Rank 1
Veteran
answered on 24 Dec 2020, 09:28 AM

Hi Dimitar,

Thank you for your prompt answer. Merry Christmas by the way.

From the video, if I'm not mistaken, you are generating the report from the report viewer, while I'm generating it at run-time thru code. Could that make difference? Could you try to use ReportProcessor to generate the report like the snippet I used?

The dll I used is 114KB, copied from bin folder where it installed. I assume it's the .Net 4.0 version. Also I switched to Nuget package, the dll installed is similar, but the result still no luck.

Since my project is embedded in a huge product (a web-server product) and will be loaded dynamically, it's not easy for me to prepare a working sample. But I checked at run time the dlls are loaded correctly to the domain, as attached. I also tried a Console project and the report generated without problem. It's really baffling since I cannot fingure out the difference between these two. I'm wondering if any other dependencies may affect the resolving since there's too many referencing dlls that might cause a conflict?

0
Randy
Top achievements
Rank 1
Veteran
answered on 24 Dec 2020, 10:57 AM
I created a webapi project and the report generated without a problem... so seems the only possibility is sth in the main product stops that dll being resolved. Do you have any idea or direction that I can probe on?
0
Randy
Top achievements
Rank 1
Veteran
answered on 24 Dec 2020, 12:50 PM

Hi Dimitar,

Finally found the problem..the dll was placed in a folder which will be loaded by DirectoryCatalog dynamically. Though it lives in AppDomain afterwards, it does not work when being called as expected. Not sure how those reporting dll works, maybe it's because there's no strong reference among them?

After place the dlls to the root bin folder of the main product, all works as it supposed to.

Thank you for your support and Merry Christmas.

Tags
General Discussions
Asked by
Randy
Top achievements
Rank 1
Veteran
Answers by
Randy
Top achievements
Rank 1
Veteran
Dimitar
Telerik team
Share this question
or