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

Telerik ReportViewer is throwing exception

2 Answers 156 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Mandar
Top achievements
Rank 1
Mandar asked on 20 Apr 2014, 01:22 PM
Hi,

I am trying to use Telerik.ReportViewer.Wpf for Print Preview functionality in our app. As per the instructions  of "How to: Add report viewer to a WPF application" given at this link: http://www.telerik.com/help/reporting/wpf-report-viewer-embedding-the-viewer.html#BindingRedirects
I did everything and added Telerik.ReportViewer.Wpf.dll ,Telerik.Windows.Controls.dll,Telerik.Windows.Controls.Input.dll,Telerik.Windows.Controls.Navigation.dll and Telerik.Windows.Data.dll references to my project. In my case there is a calling application called EMR.WPF that calls my project which contains ReportViewer and when I try to load my UserControl containing the ReportViewer control I get following exception. Now the strange thing is if I add Telerik dll references to the calling EMR.WPF app then I don't get this exception anymore and the report viewer loads fine. Of course I don't want to add references to the calling app because it's like a third party app that I don't have control over. Any idea whats going on here and how I can fix this? Please need your help soon.

System.Windows.Markup.XamlParseException occurred
  HResult=-2146233087
  Message='Initialization of 'Telerik.ReportViewer.Wpf.ReportViewer' threw an exception.' Line number '11' and line position '72'.
  Source=PresentationFramework
  LineNumber=11
  LinePosition=72
  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 CPWS.Reporting.PrintPreview.InitializeComponent() in c:\Projects\CardioPerfect\Dev\Continuous\CPWS.Windows\Views\Reporting\PrintPreview.xaml:line 1
       at CPWS.Reporting.PrintPreview..ctor() in c:\Projects\CardioPerfect\Dev\Continuous\CPWS.Windows\Views\Reporting\PrintPreview.xaml.cs:line 26
  InnerException: System.IO.FileNotFoundException
       HResult=-2147024894
       Message=Could not load file or assembly 'Telerik.Windows.Controls.Navigation, PublicKeyToken=5803cfa389c90ce7' or one of its dependencies. The system cannot find the file specified.
       Source=mscorlib
       FileName=Telerik.Windows.Controls.Navigation, PublicKeyToken=5803cfa389c90ce7
       FusionLog==== Pre-bind state information ===
LOG: DisplayName = Telerik.Windows.Controls.Navigation, PublicKeyToken=5803cfa389c90ce7
 (Partial)
WRN: Partial binding information was supplied for an assembly:
WRN: Assembly Name: Telerik.Windows.Controls.Navigation, PublicKeyToken=5803cfa389c90ce7 | Domain ID: 1
WRN: A partial bind occurs when only part of the assembly display name is provided.
WRN: This might result in the binder loading an incorrect assembly.
WRN: It is recommended to provide a fully specified textual identity for the assembly,
WRN: that consists of the simple name, version, culture, and public key token.
WRN: See whitepaper http://go.microsoft.com/fwlink/?LinkId=109270 for more information and common solutions to this issue.
LOG: Appbase = file:///C:/Projects/CardioPerfect/Dev/Continuous/EMR.WPF/bin/Debug/
LOG: Initial PrivatePath = NULL
Calling assembly : PresentationFramework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Projects\CardioPerfect\Dev\Continuous\EMR.WPF\bin\Debug\EMR.WPF.vshost.exe.Config
LOG: Using host configuration file: 
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/Projects/CardioPerfect/Dev/Continuous/EMR.WPF/bin/Debug/Telerik.Windows.Controls.Navigation.DLL.
LOG: Attempting download of new URL file:///C:/Projects/CardioPerfect/Dev/Continuous/EMR.WPF/bin/Debug/Telerik.Windows.Controls.Navigation/Telerik.Windows.Controls.Navigation.DLL.
LOG: Attempting download of new URL file:///C:/Projects/CardioPerfect/Dev/Continuous/EMR.WPF/bin/Debug/Telerik.Windows.Controls.Navigation.EXE.
LOG: Attempting download of new URL file:///C:/Projects/CardioPerfect/Dev/Continuous/EMR.WPF/bin/Debug/Telerik.Windows.Controls.Navigation/Telerik.Windows.Controls.Navigation.EXE.

       StackTrace:
            at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
            at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
            at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
            at System.Reflection.Assembly.Load(AssemblyName assemblyRef)
            at System.Windows.Baml2006.Baml2006SchemaContext.ResolveAssembly(BamlAssembly bamlAssembly)
            at System.Windows.Baml2006.Baml2006SchemaContext.ResolveBamlTypeToType(BamlType bamlType)
            at System.Windows.Baml2006.Baml2006SchemaContext.ResolveBamlType(BamlType bamlType, Int16 typeId)
            at System.Windows.Baml2006.Baml2006SchemaContext.GetXamlType(Int16 typeId)
            at System.Windows.Baml2006.Baml2006Reader.Process_ElementStart()
            at System.Windows.Baml2006.Baml2006Reader.Process_OneBamlRecord()
            at System.Windows.Baml2006.Baml2006Reader.ReadObject(KeyRecord record)
            at System.Windows.ResourceDictionary.CreateObject(KeyRecord key)
            at System.Windows.ResourceDictionary.OnGettingValue(Object key, Object& value, Boolean& canCache)
            at System.Windows.ResourceDictionary.OnGettingValuePrivate(Object key, Object& value, Boolean& canCache)
            at System.Windows.ResourceDictionary.GetValueWithoutLock(Object key, Boolean& canCache)
            at System.Windows.ResourceDictionary.GetValue(Object key, Boolean& canCache)
            at System.Windows.ResourceDictionary.GetValueWithoutLock(Object key, Boolean& canCache)
            at System.Windows.ResourceDictionary.GetValue(Object key, Boolean& canCache)
            at System.Windows.ResourceDictionary.FetchResource(Object resourceKey, Boolean allowDeferredResourceReference, Boolean mustReturnDeferredResourceReference, Boolean canCacheAsThemeResource, Boolean& canCache)
            at System.Windows.SystemResources.LookupResourceInDictionary(ResourceDictionary dictionary, Object key, Boolean allowDeferredResourceReference, Boolean mustReturnDeferredResourceReference, Boolean& canCache)
            at System.Windows.SystemResources.FindDictionaryResource(Object key, Type typeKey, ResourceKey resourceKey, Boolean isTraceEnabled, Boolean allowDeferredResourceReference, Boolean mustReturnDeferredResourceReference, Boolean& canCache)
            at System.Windows.SystemResources.FindResourceInternal(Object key, Boolean allowDeferredResourceReference, Boolean mustReturnDeferredResourceReference)
            at System.Windows.StyleHelper.GetThemeStyle(FrameworkElement fe, FrameworkContentElement fce)
            at System.Windows.FrameworkElement.UpdateThemeStyleProperty()
            at System.Windows.FrameworkElement.OnInitialized(EventArgs e)
            at System.Windows.FrameworkElement.TryFireInitialized()
            at System.Windows.FrameworkElement.EndInit()
            at MS.Internal.Xaml.Runtime.ClrObjectRuntime.InitializationGuard(XamlType xamlType, Object obj, Boolean begin)
       InnerException: 

2 Answers, 1 is accepted

Sort by
0
KS
Top achievements
Rank 1
answered on 23 Apr 2014, 03:57 PM
Hi,

And what happens if you just copy the assemblies in the other app start folder?

-KS
0
Mandar
Top achievements
Rank 1
answered on 24 Apr 2014, 08:35 PM
If I manually copy assemblies to the bin/debug folder of calling app and then load my app from calling app then I don't get any exception for report viewer and everything works.
Tags
General Discussions
Asked by
Mandar
Top achievements
Rank 1
Answers by
KS
Top achievements
Rank 1
Mandar
Top achievements
Rank 1
Share this question
or