XAML Parse Exception with ReportViewer Window

9 posts, 2 answers
  1. Aaron
    Aaron avatar
    29 posts
    Member since:
    May 2011

    Posted 30 Oct 2015 Link to this post

    Hi,
     
    I'm running VS 2015 in W10 (x64) with Telerik Reporting Q1 2015 SP1.
    I'm developing a WPF application.
    I'm getting the following XAML parse exception when attempting to show a Window containing a ReportViewer.
     
    System.Windows.Markup.XamlParseException
     
    Message: {"'Provide value on 'System.Windows.Markup.StaticResourceHolder' threw an exception. Line number '55' and line position '12'."}
    BaseUri: {pack://application:,,,/Assets/Themes/Windows8/Telerik.ReportViewer.Wpf.xaml}
     
    InnerException:
    Message: {"Cannot find resource named 'Telerik.Windows.Controls.RadProgressBar'. Resource names are case sensitive."}
    StackTrace:
     
       at System.Windows.StaticResourceExtension.ProvideValueInternal(IServiceProvider serviceProvider, Boolean allowDeferredReference)
       at System.Windows.StaticResourceExtension.ProvideValue(IServiceProvider serviceProvider)
       at MS.Internal.Xaml.Runtime.ClrObjectRuntime.CallProvideValue(MarkupExtension me, IServiceProvider serviceProvider)
     
    The Click event handler for my "Generate Report" button is throwing the exception:
     
    private void OnGenerateReportClick(object sender, RoutedEventArgs e)
    {
        EnhListReportViewerWindow elrvw = new EnhListReportViewerWindow()
        elrvw.Show();
    }
     
    The exception is thrown on "elrvw.Show();".
     
    My <Application.Resources> in App.xaml looks like this:
     
    01.<runtime>
    02.  <assemblyBinding>
    03.    <dependentAssembly>
    04.      <assemblyIdentity name="Telerik.Windows.Controls" publicKeyToken="5803cfa389c90ce7"/>
    05.      <bindingRedirect oldVersion="0.0.0.0-2015.1.401.45" newVersion="2015.1.401.45"/>
    06.    </dependentAssembly>
    07.    <dependentAssembly>
    08.      <assemblyIdentity name="Telerik.Windows.Controls.Input" publicKeyToken="5803cfa389c90ce7"/>
    09.      <bindingRedirect oldVersion="0.0.0.0-2015.1.401.45" newVersion="2015.1.401.45"/>
    10.    </dependentAssembly>
    11.    <dependentAssembly>
    12.      <assemblyIdentity name="Telerik.Windows.Controls.Navigation" publicKeyToken="5803cfa389c90ce7" />
    13.      <bindingRedirect oldVersion="0.0.0.0-2015.1.401.45" newVersion="2015.1.401.45" />
    14.    </dependentAssembly>
    15.    <dependentAssembly>
    16.      <assemblyIdentity name="Telerik.Windows.Data" publicKeyToken="5803cfa389c90ce7"/>
    17.      <bindingRedirect oldVersion="0.0.0.0-2015.1.401.45" newVersion="2015.1.401.45"/>
    18.    </dependentAssembly>
    19.  </assemblyBinding>
    20.</runtime>

     

    The "Assets" folder is at the root of my project.
     
    I have these Telerik assemblies (v4.0.30319) in my WPF project:
     
    Telerik.Reporting                    (Q1 2015 SP1, 9.0.15.324)
    Telerik.Reporting.XpsRendering       (Q1 2015 SP1, 9.0.15.324)
    Telerik.ReportViewer.Wpf             (Q1 2015 SP1, 9.0.15.324)
    Telerik.Windows.Controls             (2015.1.401.45)
    Telerik.Windows.Controls.Docking     (2015.1.401.45)
    Telerik.Windows.Controls.Input       (2015.1.401.45)
    Telerik.Windows.Controls.Navigation  (2015.1.401.45)
    Telerik.Windows.Data                 (2015.1.401.45)
     
    My report library project is called "ConsoleReportLibrary".  It has one report at the root: "EnhancementList.cs".  ConsoleReportLibrary references Telerik.Reporting (9.0.15.324).
     
    In the WPF project, my ReportViewer is declared in a Window like so:
     
    <tr:ReportViewer
        Name="ReportViewer1">
        <tr:ReportViewer.ReportSource>
            <telerikReporting:TypeReportSource TypeName="ConsoleReportLibrary.EnhancementList, ConsoleReportLibrary"/>
        </tr:ReportViewer.ReportSource>
    </tr:ReportViewer>
     
    I have assembly redirects set up in App.config like so:
     
    01.<runtime>
    02.  <assemblyBinding>
    03.    <dependentAssembly>
    04.      <assemblyIdentity name="Telerik.Windows.Controls" publicKeyToken="5803cfa389c90ce7"/>
    05.      <bindingRedirect oldVersion="0.0.0.0-2015.1.401.45" newVersion="2015.1.401.45"/>
    06.    </dependentAssembly>
    07.    <dependentAssembly>
    08.      <assemblyIdentity name="Telerik.Windows.Controls.Input" publicKeyToken="5803cfa389c90ce7"/>
    09.      <bindingRedirect oldVersion="0.0.0.0-2015.1.401.45" newVersion="2015.1.401.45"/>
    10.    </dependentAssembly>
    11.    <dependentAssembly>
    12.      <assemblyIdentity name="Telerik.Windows.Controls.Navigation" publicKeyToken="5803cfa389c90ce7" />
    13.      <bindingRedirect oldVersion="0.0.0.0-2015.1.401.45" newVersion="2015.1.401.45" />
    14.    </dependentAssembly>
    15.    <dependentAssembly>
    16.      <assemblyIdentity name="Telerik.Windows.Data" publicKeyToken="5803cfa389c90ce7"/>
    17.      <bindingRedirect oldVersion="0.0.0.0-2015.1.401.45" newVersion="2015.1.401.45"/>
    18.    </dependentAssembly>
    19.  </assemblyBinding>
    20.</runtime>
     
    The ReportViewer shows up in the designer with the Windows 8 theme, but something is going wrong at runtime.  Guidance?
     
    Thanks,
    ADJ
     
     
     
     
  2. Answer
    Stef
    Admin
    Stef avatar
    3050 posts

    Posted 03 Nov 2015 Link to this post

    Hi ADJ,

    Please check if the used XAML resources are the correct ones:
    • Get Telerik Reporting assemblies from C:\Program Files (x86)\Telerik\Reporting Q1 2015\Bin;
    • Get Telerik.ReportViewer.Wpf.xaml from C:\Program Files (x86)\Telerik\Reporting Q1 2015\Wpf\Themes;
    • Get Telerik UI for WPF assemblies from C:\Program Files (x86)\Telerik\UI for WPF Q1 2015\Binaries.NoXaml;
    • Get the corresponding XAML files (without Telerik.ReportViewer.Wpf.xaml) from C:\Program Files (x86)\Telerik\UI for WPF Q1 2015\Themes.Implicit;

    Then verify that the paths used for creating the resource dictionaries can be resolved properly at run-time. You may need to copy the XAML resources relatively to the execution folder of the application to load them properly - Pack URIs in WPF.


    I hope this information is helpful.

    Regards,
    Stef
    Telerik
    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
  3. DevCraft banner
  4. Aaron
    Aaron avatar
    29 posts
    Member since:
    May 2011

    Posted 03 Nov 2015 Link to this post

    Thanks Stef,

    I got the assemblies and XAML resources from the directories you specified and I was able to run the ReportViewer.

    I was getting not only Telerik.ReportViewer.Wpf.xaml​ from C:\Program Files (x86)\Telerik\Reporting Q1 2015\Wpf\Themes\Windows8​, but also these: 

    System.Windows.xaml
    Telerik.Windows.Controls.Input.xaml
    Telerik.Windows.Controls.Navigation.xaml
    Telerik.Windows.Controls.xaml

    I replaced those four files with the files of the same name in C:\Program Files (x86)\Telerik\UI for WPF Q1 2015\Themes.Implicit\WPF40\Windows8, and everything ran fine.

     

    Thanks again!

    - ADJ

  5. Kelly
    Kelly avatar
    7 posts
    Member since:
    Sep 2016

    Posted 22 Sep Link to this post

    I am having the same issue today.  I was not getting this exception until I upgraded to using the full Telerik Reporting License.

    I'm running VS 2015 in Win8 (x64) with Telerik Reporting R3 2016.
    I'm developing a WPF application.

    Previously I was using a TRIAL Reporting & UI for WPF license and no errors with this. I just upgraded to the full version, and ditched UI for WPF and used the necessary .dlls from the WPF Example inside of the Reporting installation as is recommended here (http://docs.telerik.com/reporting/wpf-report-viewer-manual-setup)

    I have all .dll resources referenced from a local directory. They are:

    Telerik.Reporting 10.2.16.914
    Telerik.Reporting.XpsRendering 10.2.16.914
    Telerik.ReportViewer.Wpf 10.2.16.914
     
    Telerik.Windows.Controls 2016.3.914.40
    Telerik.Windows.Controls.Input 2016.3.914.40
    Telerik.Windows.Controls.Navigation 2016.3.914.40
    Telerik.Windows.Controls.Data 2016.3.914.40

     

    I am NOT including the Theme .xaml files for System.Windows.xaml, Telerik.Windows.Controls.Input.xaml, etc.  This is because they override my application's styles. I HAVE included Telerik.ReportViewer.Wpf.xaml. This was working fine with my TRIAL version of Reporting. I have verified that the .dlls are being copied to the correct directory on build.

    Now suddenly I get the exception "Cannot find resource named 'Telerik.Windows.Controls.RadProgressBar'. Resource names are case sensitive." mentioned in the original post.

    I have tried Stef's advice above except for point 3 (UI for WPF assemblies Binaries.NoXaml) since I am using the Reporting WPF example's assemblies. And point 4 - Im only using the Telerik.ReportViewer.Wpf.xaml file - but when I do add the rest of the XAML files from C:\Program Files (x86)\Telerik\UI for WPF Q1 2015\Themes.Implicit I still get the same error.

     

    Is anyone able to help?

  6. Stef
    Admin
    Stef avatar
    3050 posts

    Posted 27 Sep Link to this post

    Hi Kelly,

    If you have license for Telerik UI for WPF, please test the following:
    1. Add the required Telerik UI for WPF and the corresponding XAML resources. Without the XAML resources the viewer will not be rendered.
    2. Run Telerik UI for WPF Upgrade Wizard to assure references and XAMl files are updated correctly;
    3. Add references to Telerik Reporting and the WPF ReportViewer;
    4. Add the corresponding viewer's XAML file only;
    5. Run Telerik Reporting Upgrade Wizard to assure references are updated;

    If you are using only Telerik Reporting steps 1 and 2 should use the DLLs and XAML files provided by Telerik Reporting - Installation directories. Skip step 3.

    For more details check WPF ReportViewer: Manual Setup.


    If there are conflicts in styles, test declaring the resource dictionaries only for the control with the viewer.

    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
  7. Kelly
    Kelly avatar
    7 posts
    Member since:
    Sep 2016

    Posted 27 Sep Link to this post

    Hi Stef, thanks for your response - I started over and tried to do as you said, following the linked examples. I am just using Telerik Reporting.

    I included the following from C:\Program Files (x86)\Telerik\Reporting R3 2016\Bin:

    Telerik.Reporting 10.2.16.914
    Telerik.Reporting.XpsRendering 10.2.16.914
    Telerik.ReportViewer.Wpf 10.2.16.914

    I also included the following from C:\Program Files (x86)\Telerik\Reporting R3 2016\Examples\CSharp\WpfDemo\bin:

    Telerik.Windows.Controls 2016.3.914.40
    Telerik.Windows.Controls.Input 2016.3.914.40
    Telerik.Windows.Controls.Navigation 2016.3.914.40

    Telerik.Windows.Data 2016.3.914.40

    I also included the XAML styling files from C:\Program Files (x86)\Telerik\Reporting R3 2016\Examples\CSharp\WpfDemo\Themes\Windows7 AND added them to my App.xaml:

                   

    <ResourceDictionary Source="Themes/System.Windows.xaml">
    <ResourceDictionary Source="Themes/Telerik.ReportViewer.Wpf.xaml"/>
    <ResourceDictionary Source="Themes/Telerik.Windows.Controls.xaml"/>
    <ResourceDictionary Source="Themes/Telerik.Windows.Controls.Input.xaml">
    <ResourceDictionary Source="Themes/Telerik.Windows.Controls.Navigation.xaml"/>

    I ran the Telerik Reporting Upgrade Wizard with all Successes.

    When I open the window in my app with the ReportViewer on it I get this exception:

    Exception thrown: 'System.Windows.Markup.XamlParseException' in PresentationFramework.dll
     
    Additional information: Provide value on 'System.Windows.Markup.StaticResourceHolder' threw an exception.
     
    Inner Exception: Cannot find resource named 'Telerik.Windows.Controls.RadProgressBar'. Resource names are case sensitive.

  8. Kelly
    Kelly avatar
    7 posts
    Member since:
    Sep 2016

    Posted 27 Sep Link to this post

    Please note that if I do include the UI for WPF trial DLLs at version 2016.3.914.45 and do not include the extra XAML styling files, the Report Viewer works perfectly. My solution must use Telerik Reporting only, however.
  9. Stef
    Admin
    Stef avatar
    3050 posts

    Posted 29 Sep Link to this post

    Hi Kelly,

    You need to use only DLLs and XAML resources of Telerik UI for WPF distributed by Telerik Reporting. these DLLs are Trial version, unlocked when controls are used in the scope of the WPF ReportViewer.

    For more details check http://docs.telerik.com/reporting/wpf-report-viewer-manual-setup.


    Check the project settings with the above linked article's steps. Verify that you are not referencing license Telerik UI for WPF assemblies, or assemblies not distributed by Telerik Reporting. Also check if XAML files are loaded correctly with the set paths.

    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
  10. Answer
    Kelly
    Kelly avatar
    7 posts
    Member since:
    Sep 2016

    Posted 29 Sep in reply to Stef Link to this post

    Hi Stef,

    I figured out my issue after going through it one more time.  I'm new to WPF and didn't realize the order of included <ResourceDictionary>'s in the App.xaml mattered.  I had Telerik.ReportViewer.Wpf.xaml out of order.

    Making sure they were in the order in the document and in the Wpf Example's App.xaml file worked.

    Thanks for your help.

Back to Top
DevCraft banner