Telerik.ReportViewer.Silverlight.ZoomConverter.Convert Message: System.InvalidCastException: Specified cast is not valid

11 posts, 1 answers
  1. Charlie
    Charlie avatar
    24 posts
    Member since:
    Jan 2009

    Posted 23 Feb 2012 Link to this post

    I am using the Silverlight Report Viewer to render reports via the Telerik Reporting Service.   These reports worked fine when I was using Telerik Reporting 2011 Q3 SP 1 and RadControls for Silverlight 2011 Q3 SP1. My Silverlight Application hosting the Telerik Silverlight Viewer was set for targeting Silverlight 4.  

    I recently upgraded to Telerik Reporting 2012 Q1 and RadControls for Silverlight 2012 Q1.   I also changed the Silverlight Application hosting the Telerik Silverlight Viewer to targeting Silverlight 5. 

    Everything compiled without errors or warnings.  But when I ran the report I got the error and stack trace below.

    1.)   Does the Telerik Silverlight Viewer for Telerik Reporting 2012 Q1 works with targeting Silverlight 5?
    2.)   Are there breaking changes for targeting Silverlight 5 for Telerik Reporting 2012 Q1 and RadControls for Silverlight 2012 Q1?



    Webpage error details

     

    User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; GTB7.2; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.2; .NET CLR 1.1.4322; .NET4.0C; .NET4.0E; OfficeLiveConnector.1.5; OfficeLivePatch.1.3; Zune 4.7)

    Timestamp: Thu, 23 Feb 2012 22:10:15 UTC

     

     

    Message: Unhandled Error in Silverlight Application

    Code: 4004   

    Category: ManagedRuntimeError      

    Message: System.InvalidCastException: Specified cast is not valid.

       at Telerik.ReportViewer.Silverlight.ZoomConverter.Convert(Object value, Type targetType, Object parameter, CultureInfo culture)

       at System.Windows.Data.BindingExpression.ConvertToTarget(Object value)

       at System.Windows.Data.BindingExpression.UpdateTemporaryValue()

       at System.Windows.Data.BindingExpression.GetValue(DependencyObject d, DependencyProperty dp)

       at System.Windows.DependencyObject.EvaluateExpression(DependencyProperty property, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry)

       at System.Windows.DependencyObject.EvaluateBaseValue(DependencyProperty property, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, ValueOperation operation)

       at System.Windows.DependencyObject.EvaluateEffectiveValue(DependencyProperty property, EffectiveValueEntry oldEntry, EffectiveValueEntry newEntry, ValueOperation operation)

       at System.Windows.DependencyObject.UpdateEffectiveValue(DependencyProperty property, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, ValueOperation operation)

       at System.Windows.DependencyObject.RefreshExpression(DependencyProperty dp)

       at System.Windows.Data.BindingExpression.SendDataToTarget()

       at System.Windows.Data.BindingExpression.SourceAcquired()

       at System.Windows.Data.BindingExpression.System.Windows.IDataContextChangedListener.OnDataContextChanged(Object sender, DataContextChangedEventArgs e)

       at System.Windows.Data.BindingExpression.DataContextChanged(Object sender, DataContextChangedEventArgs e)

       at System.Windows.DataContextChangedEventHandler.Invoke(Object sender, DataContextChangedEventArgs e)

       at System.Windows.FrameworkElement.OnDataContextChanged(DataContextChangedEventArgs e)

       at System.Windows.FrameworkElement.OnAncestorDataContextChanged(DataContextChangedEventArgs e)

       at System.Windows.FrameworkElement.NotifyDataContextChanged(DataContextChangedEventArgs e)

       at System.Windows.FrameworkElement.OnAncestorDataContextChanged(DataContextChangedEventArgs e)

       at System.Windows.FrameworkElement.NotifyDataContextChanged(DataContextChangedEventArgs e)

       at System.Windows.FrameworkElement.OnAncestorDataContextChanged(DataContextChangedEventArgs e)

       at System.Windows.FrameworkElement.NotifyDataContextChanged(DataContextChangedEventArgs e)

       at System.Windows.FrameworkElement.OnAncestorDataContextChanged(DataContextChangedEventArgs e)

       at System.Windows.FrameworkElement.NotifyDataContextChanged(DataContextChangedEventArgs e)

       at System.Windows.FrameworkElement.OnAncestorDataContextChanged(DataContextChangedEventArgs e)

       at System.Windows.FrameworkElement.NotifyDataContextChanged(DataContextChangedEventArgs e)

       at System.Windows.FrameworkElement.OnAncestorDataContextChanged(DataContextChangedEventArgs e)

       at System.Windows.FrameworkElement.NotifyDataContextChanged(DataContextChangedEventArgs e)

       at System.Windows.FrameworkElement.OnPropertyChanged(DependencyProperty dp)

       at System.Windows.DependencyObject.RaisePropertyChangeNotifications(DependencyProperty dp, Object oldValue, Object newValue)

       at System.Windows.DependencyObject.UpdateEffectiveValue(DependencyProperty property, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, ValueOperation operation)

       at System.Windows.DependencyObject.SetValueInternal(DependencyProperty dp, Object value, Boolean allowReadOnlySet, Boolean isBindingInStyleSetter)

       at Telerik.ReportViewer.Silverlight.ReportViewer.Initialize()

       at Telerik.ReportViewer.Silverlight.ReportViewer.OnApplyTemplate()

       at System.Windows.FrameworkElement.OnApplyTemplate(IntPtr nativeTarget)    

     

    Line: 33

    Char: 5

    Code: 0

    URI: https://athos.sscs.ad/CPB/scripts/handle_silverlight_error-1.0.0.js

     
    Thanks,

    Charlie J.

  2. Charlie
    Charlie avatar
    24 posts
    Member since:
    Jan 2009

    Posted 27 Feb 2012 Link to this post

    Anybody from Telerik want to address my issue?  


    Thanks,

    Charlie J.



  3. Charlie
    Charlie avatar
    24 posts
    Member since:
    Jan 2009

    Posted 27 Feb 2012 Link to this post

    I had to go back to Telerik Reporting 2011 Q3 SP1 to get my reports to work again.   The Silverlight application that is hosting the Telerik Report Viewer is targeting Silverlight 5 and is working.   It is when I install Telerik Reporting 2012 Q1 is when the reports stop working and I get the ZoomConverter Error Message.

    Thanks,

    Charlie J.

  4. Answer
    Steve
    Admin
    Steve avatar
    10942 posts
    Member since:
    Feb 2014

    Posted 28 Feb 2012 Link to this post

    Hi Charlie,

    We have introduced a change to the ZoomConverter due to the Silverlight report viewer localization we introduced in the Q1 2012 release and any old viewer template would no longer be valid. You would need to extract the new template from the Q1 2012 version and apply your customizations on it.

    Please have in mind that currently the Silverlight report viewer has problems with the printing under Silverlight 5, this issue would be fixed for the upcoming internal build/service pack.

    Greetings,
    Steve
    the Telerik team

    NEW in Q1'12: Telerik Report Designer (Beta) for ad-hoc report creation. Download as part of Telerik Reporting Q1 2012. For questions and feedback, use the new Telerik Report Designer Forum.

  5. Charlie
    Charlie avatar
    24 posts
    Member since:
    Jan 2009

    Posted 28 Feb 2012 Link to this post

    Thanks Steve.  I will give that a try when the Silverlight 5 Printing issue is resolved.

     

    Thanks,

     

    Charlie J.

  6. Houdini
    Houdini avatar
    9 posts
    Member since:
    Feb 2012

    Posted 20 Apr 2012 Link to this post

    Hi Steve,
    I have an issue similar to this one. However, I am not targeting silverlight 5 anywhere. I spent much time designing the report and it runs fine from the project. However, as soon as I reference it in my silverlight application and try to run it, I am presented with the same error as above. Could you assist me here just a bit, please. I am using the latest build of the Silverlight report viewer, I tried updating the rest of my rad controls with the assemblies that came with the examples, [that broke other areas in my application] along with the stupid Parser_SetValue_Exception on my report page. This is just crazy!!! everything works fine when I first built the report and tested it in the same solution, but now that I referenced the assembly in the Silverlight application everything is gone mad.


    /*
    Houdini
    */

  7. Steve
    Admin
    Steve avatar
    10942 posts
    Member since:
    Feb 2014

    Posted 21 Apr 2012 Link to this post

    Hello Houdini,

    The reference to the Report class library is added to the web application hosting the Silverlight application and not to the Silverlight application directly. As noted in our previous post which is marked as a solution
    this error occurred with the change to the ZoomConverter we made for the Silverlight localization feature. So if you have made changes to the Silverlight viewer template, upgrading the assemblies only would not resolve the problem. You would need to extract the new template from the Q1 2012 version and apply your customizations on it.

    All the best,
    Steve
    the Telerik team

    BLOGGERS WANTED! Write a review about Telerik Reporting or the new Report Designer, post it on your blog and get a complimentary license for Telerik Reporting. We’ll even promote your blog and help bring you a few fresh readers. Yes, it’s that simple. And it’s free. Get started today >

  8. Houdini
    Houdini avatar
    9 posts
    Member since:
    Feb 2012

    Posted 21 Apr 2012 Link to this post

    Thanks for your reply Steve, for sure I added the assembly to the web project (after all it literally can't be added to the silverlight one), bad wording on my part. However, I am using the viewer from Q1 2012. Is there another way to extract the Q1 2012 template?

    Oh and by the way, did I mention that my application is WCF RIA? it is. Would this have anything to do with the difficulties being faced?  I would suppose not since I created a new silverlight business application just to test this. When I added the report it showed just fine. Everything is practically the same for my real app, it just wont show anything but the error. Even this line; <telerik: ReportViewer />, generates the error.
    /*
    Houdini
    */

  9. Steve
    Admin
    Steve avatar
    10942 posts
    Member since:
    Feb 2014

    Posted 23 Apr 2012 Link to this post

    Hello Houdini,

    We cannot say for certain what is the problem if you have verified that the previously suggested things are correct. The version of the

    • Telerik.Windows.Controls.dll
    • Telerik.Windows.Controls.Input.dll
    • Telerik.Windows.Controls.Navigation.dll
    assemblies should be 2012.1.215.1040. The version of Telerik.ReportViewer.Silverlight.dll should be 6.0.12.215.

    If you're still having problems, please isolate it in a sample project and attach it as archive in a support ticket. Once we review it, we would be able to provide you with more info.

    All the best,
    Steve
    the Telerik team

    BLOGGERS WANTED! Write a review about Telerik Reporting or the new Report Designer, post it on your blog and get a complimentary license for Telerik Reporting. We’ll even promote your blog and help bring you a few fresh readers. Yes, it’s that simple. And it’s free. Get started today >

  10. Houdini
    Houdini avatar
    9 posts
    Member since:
    Feb 2012

    Posted 23 Apr 2012 Link to this post

    Thanks for your help Steve. But God has answered my prayer as usual and has pointed me in the right path yet again. Therefore, I will advise of such ways and hopefully you will include this bit in your instructions to clients wishing to use your reporting.

    The report viewer is using whatever theme is set for the application. My application is using the expression dark theme from Q3 2011. Obviously there are some incompatibility with using themes prior to Q1 2011 with the report. Therefore, I extracted a theme from the example folder (C:\Program Files (x86)\Telerik\Reporting Q1 2012\Examples\CSharp\SilverlightDemo\bin) and explicitly applied it to the report viewer as such (since I only wanted the viewer to have this theme): <Telerik_ReportViewer_Silverlight:ReportViewer telerik:StyleManager.Theme="Vista" />. In this case I extracted the Vista theme. This works well and killed that stupid error. My report is now showing.

    /*
    Houdini
    I do nothing on my own,
    but only through the power
    of the God of creation
    */

  11. Steve
    Admin
    Steve avatar
    10942 posts
    Member since:
    Feb 2014

    Posted 24 Apr 2012 Link to this post

    Hi Houdini,

    I've already pointed this as a solution in our very first reply to your inquiry: "You would need to extract the new template from the Q1 2012 version and apply your customizations on it."

    Kind regards,
    Steve
    the Telerik team

    BLOGGERS WANTED! Write a review about Telerik Reporting or the new Report Designer, post it on your blog and get a complimentary license for Telerik Reporting. We’ll even promote your blog and help bring you a few fresh readers. Yes, it’s that simple. And it’s free. Get started today >

Back to Top