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

ReportViewer stays blank

6 Answers 67 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
NiccoMlt
Top achievements
Rank 1
Veteran
NiccoMlt asked on 25 Jan 2021, 03:17 PM

Hi,

I implemented a WPF window containing a ReportViewer control meant to show the preview of a report; the workflow is the following:

  1. a report is programmatically built,
  2. an ObjectDataSource is attached to the report,
  3. an InstanceReportSource is set in the ReportViewer object referring to the created report object,
  4. finally the window containing the reportviewer is shown.

Unfortunately, the opened window contains a blank space instead of the ReportViewer control. Note that:

  • The window stays reactive, so it is not stuck
  • Every other component in the window loads correctly, and I can interact with them
  • I checked via task manager and Visual Studio profiler, and there is no big usage on CPU or RAM whatsoever.

What can possibly be the cause of the wpf control staying completely blank?

6 Answers, 1 is accepted

Sort by
0
Yana
Telerik team
answered on 26 Jan 2021, 07:25 AM

Hi Nicco,

One possible reason for not viewing the report is if the needed styles are not merged in App.xaml.  Please take a look at step 6 of the following documentation article:

How to Add manually report viewer to a WPF .NET Framework project

and make sure the required resource dictionaries are available to the ReportViewer.

Other than that,  you can use a Trace Listener to see whether our code will log information relevant to the problem.

Give these suggestions a try and let me know the result.

Regards,
Yana
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
NiccoMlt
Top achievements
Rank 1
Veteran
answered on 27 Jan 2021, 11:17 AM

Hi Yana,

thank you for your answer,

I think you found the problem: I didn't merged the ResourceDictionaries.

Sadly, adding the dictionaries raised another problem: apparently the program fails when starting the Application with the following error

System.Windows.Markup.XamlParseException
  HResult=0x80131501
  Message='Set property 'System.Windows.ResourceDictionary.Source' threw an exception.' Line number '10' and line position '18'.
  Source=PresentationFramework
  StackTrace:
   at System.Windows.Markup.WpfXamlLoader.Load(XamlReader xamlReader, IXamlObjectWriterFactory writerFactory, Boolean skipJournaledProperties, Object rootObject, XamlObjectWriterSettings settings, Uri baseUri)
   at System.Windows.Markup.WpfXamlLoader.LoadBaml(XamlReader xamlReader, Boolean skipJournaledProperties, Object rootObject, XamlAccessLevel accessLevel, Uri baseUri)
   at System.Windows.Markup.XamlReader.LoadBaml(Stream stream, ParserContext parserContext, Object parent, Boolean closeStream)
   at System.Windows.Application.LoadComponent(Object component, Uri resourceLocator)
   at ProgramProcess.Telerik.App.InitializeComponent() in C:\Repository\Star4\ProgramProcess\Telerik\App.xaml:line 1
 
Inner Exception 1:
FileNotFoundException: Could not load file or assembly 'Telerik.ReportViewer.Wpf.Themes, Culture=neutral' or one of its dependencies. The system cannot find the file specified.

I already checked the project references and they seems to be imported correctly.

0
Accepted
Neli
Telerik team
answered on 01 Feb 2021, 09:40 AM

Hi Nicco,

Note that starting with Telerik Reporting R2 2018 SP1 (12.1.18.620) the Themes are provided with the Telerik.ReportViewer.Wpf.Themes assembly, and it should be available in the bin folder of the application. Hence, the property Copy Local of the assembly should be set to True - the default is False. 

Also,  is it possible that the Telerik.ReportViewer.Wpf.Themes.dll is locked for the machine where the problem occurs?

If the issue is not resolved, please, consider sending us the problematic application, so we can inspect it locally.

Regards,
Neli
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
NiccoMlt
Top achievements
Rank 1
Veteran
answered on 01 Feb 2021, 09:44 AM

Hi Neli,

thank you for your answer.

What do you mean by saying the DLL may be locked for the machine? Could you please explain it better?

0
NiccoMlt
Top achievements
Rank 1
Veteran
answered on 01 Feb 2021, 11:27 AM

In addition to my previous message, I also checked the property Copy Local and it is set to True correctly.

I also tried removing and adding the ReportViewer via the Wizard to let the Telerik Extension for Visual Studio automatically configure the project, but I get the error in the picture attached: apparently, it manages to add the dependencies required in documentation, but it fails to add Telerik.ReportViewer.Wpf.Design.Resources.Telerik.Windows.Data, probably because of path problems.

What do you think?

 

0
NiccoMlt
Top achievements
Rank 1
Veteran
answered on 02 Feb 2021, 04:00 PM

I found the problem! The project I am working on has a weird project structure, and the process which spawns the GUI is inside a different project than the one the window is compiled on; I basically was referencing DLLs only in the latter project.

Tags
General Discussions
Asked by
NiccoMlt
Top achievements
Rank 1
Veteran
Answers by
Yana
Telerik team
NiccoMlt
Top achievements
Rank 1
Veteran
Neli
Telerik team
Share this question
or