Exception occured :-/

13 posts, 1 answers
  1. Philippe
    Philippe avatar
    8 posts
    Member since:
    Nov 2011

    Posted 09 Mar 2012 Link to this post

    Hi !

    Got this exception using a the Breadcrumb version 2012.1.221.40

    Hard to reproduce on will in my application context but happens sometimes. 

    Tell me whether you need more information.

    Regards,
    Phil

    ===================================
    Object reference not set to an instance of an object. (Telerik.Windows.Controls.Navigation)
    ------------------------------
    Program Location:
       at Telerik.Windows.Controls.Breadcrumb.RadBreadcrumbBar.<>c__DisplayClass5.<SafelyRemoveItemFromOverflow>b__4() in c:\TB\105\WPF_Scrum\Current_HotFix\Sources\Development\Controls\Navigation\Breadcrumb\RadBreadcrumbBar.cs:line 118
       at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
       at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)

    Source code:

                                <telerik:RadBreadcrumb 
                                            HorizontalAlignment="Stretch"
                                            VerticalAlignment="Center"
                                            VerticalContentAlignment="Center"
                                            Header="{Binding AddressBarPresenter.XmlDocument.Root}" 
                                            ItemsSource="{Binding AddressBarPresenter.XmlDocument.Root.AllFields, Mode=OneWay, IsAsync=True}"
                                            TextModePath="XPathName"
                                            Path="{Binding AddressBarPresenter.CurrentXPath, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                                            PathSeparator="/"    
                                            IsHistoryEnabled="True"
                                            IsIconVisible="False">
                                    <local:Breadcrumb.HeaderTemplate>
                                        <DataTemplate>
                                            <TextBlock Text="{Binding XPathName}" />
                                        </DataTemplate>
                                    </local:Breadcrumb.HeaderTemplate>
                                    <local:Breadcrumb.ItemTemplate>
                                        <HierarchicalDataTemplate ItemsSource="{Binding AllFields, Mode=OneWay, IsAsync=True}">
                                            <HierarchicalDataTemplate.ItemTemplate>
                                                <DataTemplate>
                                                    <TextBlock Text="{Binding XPathName}" />
                                                </DataTemplate>
                                            </HierarchicalDataTemplate.ItemTemplate>
                                            <TextBlock Text="{Binding XPathName}" />
                                        </HierarchicalDataTemplate>
                                    </local:Breadcrumb.ItemTemplate>
                                </telerik:RadBreadcrumb>
  2. Philippe
    Philippe avatar
    8 posts
    Member since:
    Nov 2011

    Posted 09 Mar 2012 Link to this post

    I just submitted an issue in the tracker for this exception as well.
  3. UI for WPF is Visual Studio 2017 Ready
  4. Zarko
    Admin
    Zarko avatar
    755 posts

    Posted 14 Mar 2012 Link to this post

    Hello,
    Thank you for the feedback! Unfortunately I wasn't able to reproduce this issue so I'd like to ask for some more information - could you reproduce it with older ddls (2011.3.1220), how exactly are you using the Breadcrumb, do you dynamically change the Path, ItemsSource or something else and etc. I've attached the sample project that I used for testing so you could examine it and try to reproduce your problem with it.
    We're looking forward to hearing from you again.

    Regards,
    Zarko
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  5. Philippe
    Philippe avatar
    8 posts
    Member since:
    Nov 2011

    Posted 20 Mar 2012 Link to this post

    Hi !

    Sorry I just posted this issue before leaving on vacation :-)
    I'm back now and tried to reproduce the pb for a whole day without success based on your sample.

    I modified it to match to the closest the real application but no way :-/

    I added two derived based classes Myitem and AnotherItem which does not implement the AllFields field. But it just raise a binding error but not the exception.

    I tried to switch the root value in code behind.

    I tried to reproduce the workaround used in the application regarding the issue about the changing the CurrnetXPaththat does not fully change the breadcrumb Path itself (only one more level on each call, so we split the path in chunks and call them all on dispatcher !, see this related fix here for silverlight http://www.telerik.com/support/pits.aspx#/public/silverlight/7544 )

    I'm sorry, but I only have access to the exception in logs from the real application, but no way to reproduce and debug it live to figure out what's the cause of the crash.

    Could you give me a clue about what causes the crash in the breadcrumb sources ? which field is involved there ? the ItemsSource, the Path ? the Root ?

    PS : can't send you back the modified project as a zip archive even renamed as .png < 2mb :-(
  6. Zarko
    Admin
    Zarko avatar
    755 posts

    Posted 21 Mar 2012 Link to this post

    Hi,
    As far as I could see the exception comes from the SafelyRemoveItemFromOverflow method which does exactly what its name says - it removes items from the items collection of the Overflow item (the small dropdownbutton that appears in the right end when your Breadcrumb's width is too small to snow all items from the path).
    After your ticket we took a look at our code and added some more verifications so I'd like to ask you to download our Q1 2012 SP (it will be available until the end of the week) and see if this issue still occurs.
    We are looking forward to hearing from you.

    Greetings,
    Zarko
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  7. Philippe
    Philippe avatar
    8 posts
    Member since:
    Nov 2011

    Posted 22 Mar 2012 Link to this post

    Ok, so maybe that's why I couldn't reproduce it on my own machine with my application in full screen mode.
    The breadcrumb path always fit the width within the available space on my 24" monitor I guess.

    I 'll try to check that as soon as I can with the current version I use and see whether the Q1 SP helps in any way to avoid the exception.

    Regarding the other issue about setting the path in code-behind or binding ?
    Any chance to get the correction from the Silverlight version of the control retrofited to the WPF version any time soon ?

    Look at what I 've got to do in code to workaround this other issue in the example you submitted to me (it's really ugly !)

                // this doesn't work as one could expect !
                //this.mvm.CurrentXPath = "/Root/Item_1/Item_1_2/Item_1_2_1/@Item";

                // we have to split the path and set it by adding a level one by one in background
                var xPath = "/Root/Item_1/Item_1_2/Item_1_2_1/@Item";
                var split = xPath.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
                xPath = "";
                foreach (var s in split)
                {
                    xPath += "/" + s;
                    var temp = xPath;
                    Dispatcher.BeginInvoke((Action)(() =>
                        {
                                this.mvm.CurrentXPath = temp;
                        }), DispatcherPriority.Background);
                }
  8. Philippe
    Philippe avatar
    8 posts
    Member since:
    Nov 2011

    Posted 22 Mar 2012 Link to this post

    Good news, I m now able to reproduce it !

    As expected, I just had to make breadcrumb smaller so that the full path cannot be displayed entirely and then change of file (and therefore of path and available overflowitems.

    So I m now looking forward for your SP to try it out.

    PS : my tweak about changing the whole current path at once using the dispatcher does not always work as expected sometimes, so if you had a real solution, I m ready to try it also ;-)
  9. Zarko
    Admin
    Zarko avatar
    755 posts

    Posted 26 Mar 2012 Link to this post

    Hello,
    I'm glad that you were able to reproduce this issue and we'll appreciate it if you could send us a sample project so that we could fix it (if it's still present in the Q1 SP).
    As for the Path property - the problem is in this binding:
    ItemsSource="{Binding AllFields, Mode=OneWay, IsAsync=True}"
    and more precisely in the "IsAsync=True" part. In the RadBreadcrumb when you change the Path property we go throung the items from all hierarchy levels and try to find a sequence of items that match the new Path.
    Example: lets say that the new Path is "Root/Item 1/Item 1 . 2/Item 1 . 2 . 1", first we'll find the item with TextModePath "Item 1"(Item1), we'll add it to the BreadcrumbBar and then we'll go through its items and try to find item with path "Item 1 . 2"(Item12) and etc. But if you've set the IsAsync to True when we find Item1 its items won't be populated yet and we won't be able to find Item12.
    I've attached a project without the IsAsync=True and everything seems to work fine in it so we'll be waiting for you response.

    Kind regards,
    Zarko
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  10. Philippe
    Philippe avatar
    8 posts
    Member since:
    Nov 2011

    Posted 27 Mar 2012 Link to this post

    Ok, I've got rid of the asynch binding now the path works as expected.
    I originally put the async option, because it can take quite some time to compute all the siblings for each level of a long path.

    However, could you tell me if this computation of the list of "item flows" is done on the fly when the popup is shown or right away when the path is parsed ?

    Regarding, the original issue, the exception still occurs (even with the async binding options omitted) in my target application but not my sample project unfortunately :-(

    I can't figure what's make the difference in behavior yet. I'm still working on it as I would like to embed your breadcrumb in my next release.

    Thanks for your kind support.

    [EDIT] I ve made the test myself and the item flows are computed when the path is changed not later when the popup is shown.
  11. Philippe
    Philippe avatar
    8 posts
    Member since:
    Nov 2011

    Posted 27 Mar 2012 Link to this post

    Well, I finally reproduced it :-)

    I've got a sample project if you want but I don't know how to send it back to you as a reply !

    The exception occurs when you create a long path, longer than the width of the breadcrumb so that the first left  levels of the path are hidden.

    Then you change the Root WITHOUT property changed notification, then the CurrentXPath with immediate notification of change, and then you raise the deferred notification of change of the Root value and ... boom !

    I admit this is not the preferred way to raise the change notifications (inverted)  but it should not crash however, right ? ;-) 

    I fixed the notification order in my own application and it does not crash anymore. So there's no hurry anymore for the delivery of a patch on your side.

    Thanks for your time and support.
  12. Answer
    Zarko
    Admin
    Zarko avatar
    755 posts

    Posted 30 Mar 2012 Link to this post

    Hello,
    Thank you for the detailed information on the bug reproduction - with it I was finally able to reproduce it and I'm glad to tell you that the exception is not present in the Q1 2012 SP (2012.1.0326) :).
    I've updated your telerik account and if you have any further questions please feel free to ask.

    Greetings,
    Zarko
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  13. Philippe
    Philippe avatar
    8 posts
    Member since:
    Nov 2011

    Posted 30 Mar 2012 Link to this post

    Thanks for the points :-)

    Keep the good work on.

    Cheers.
  14. mikels
    mikels avatar
    1 posts
    Member since:
    Feb 2014

    Posted 20 Feb 2014 Link to this post

    I used PathTooDeep.com and was very pleased with its
    performance. Long Path Tool is awesome to get rid on your long path files. Good
    luck!

Back to Top
UI for WPF is Visual Studio 2017 Ready