Menu bar throws "MenuHoverHandler" error when navigating a way.


I have a menubar in a page as follows:




It works fine in the page, and does everything I expect of it.

However, when I navigate away from the page using NavigationManager.NavigateTo(), I often get this error:

System.NullReferenceException: Object reference not set to an instance of an object.
   at Syncfusion.Blazor.Navigations.Internal.CreateMenuItem`2.MenuHoverHandler(TItem item)
   at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task)
   at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle)

It happens 4 out of every 5 tries.

Any ideas on where I can start looking to fix this?



12 Replies 1 reply marked as answer

AS Aravinthan Seetharaman Syncfusion Team December 1, 2020 05:02 PM UTC

Hi Joseph Tan, 
  
We have checked your reported query, and we can not able to reproduce this issue in our end. 
Could  you please get back to us with issue replicable sample, based on that we will check and provide you a better solution quickly. 
  
Regards, 
Aravinthan S. 



JT Joseph Tan December 2, 2020 01:14 AM UTC

Hi,

It has something to do with 
  • The user hovering over other menu items before the target page loads
  • The target  page loading slowly.
I have modified your solution where this is reproducible with the help  of a debugger: 
1. Put a break point in FetchData.razor:47 
2. Run the project
3. Click on any menu item.
4. Move your mouse over the other menu items, before the break point is hit.
5. Step over the breakpoint.
6. Exception thrown: 



NOTE: You may have to repeat this procedure a few times. It happens for me every 3-4 times I try it.

In my app, the target page takes about 3-4 seconds to render, so this behaviour occurs about 75% of the time, as long as the mouse moves over other menu items before the target page loads. 



Attachment: SfMenu699751723JT_bf78a5cb.zip


AS Aravinthan Seetharaman Syncfusion Team December 2, 2020 03:07 PM UTC

Hi Joseph Tan, 
  
Thanks for contacting Syncfusion support. 
We have checked your reported issue as per your procedure, but we can not able to reproduce this issue in our end. So before we proceed further we would like to let we know the following details. 
  
1) Please share your Visual Studio Version. 
2) If possible, share video demo for reproducing the issue. 
We have prepared video based on your instruction, as in the link: 
Could you please check the above details and get back to us with more details, if you need any further assistance on this. 
  
Regards, 
Aravinthan S. 



JT Joseph Tan December 2, 2020 07:17 PM UTC

Visual Studio 16.8.2

Here is a video of the problem: https://drive.google.com/file/d/1Q4vTdp60ojicoXTQ9QrPkAI9_HVrrMB5/view?usp=sharing

I used the same solution that I sent to you.




AS Aravinthan Seetharaman Syncfusion Team December 3, 2020 05:18 PM UTC

Hi Joseph Tan, 
  
We have checked your issue. We can able to reproduce this issue when trying this on counter page only. 
The reason for this issue is not giving @page "/counter" in counter.razor which is already used in  NavMenu.razor page. 
So, please ensure all the razor pages have valid @page directive that is refered in NavMenu.razor 
Please get back to us, if you need any further assistance on this. 
  
  
Regards, 
Aravinthan S. 



JT Joseph Tan December 3, 2020 08:11 PM UTC

Hi There,

You may have found a different bug. 

I have changed the solution to reproduce it in a different way, as attached. 

(no breakpoint needed)
1. Click on FetchData
2. Click on any menu item
3. Move the mouse over the menu 
4. Exception Thrown

System.NullReferenceException: Object reference not set to an instance of an object.
   at Syncfusion.Blazor.Navigations.Internal.CreateMenuItem`2.MenuHoverHandler(TItem item)
   at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task)
   at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle)
fail: Microsoft.AspNetCore.Components.Server.Circuits.CircuitHost[111]
      Unhandled exception in circuit 'eX-id-xDj4mAGsiK1BZsium_TPoAvSJpVAby0RmbXxQ'.
System.NullReferenceException: Object reference not set to an instance of an object.
   at Syncfusion.Blazor.Navigations.Internal.CreateMenuItem`2.MenuHoverHandler(TItem item)
   at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task)
   at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle)



Attachment: SfMenu699751723JT2_4cc88496.zip


AS Aravinthan Seetharaman Syncfusion Team December 4, 2020 05:00 PM UTC

Hi Joseph Tan, 
  
We have checked your reported issue, and we can able to reproduce this issue in Version 18.3.0.50. 
We have already fixed this issue in our latest version 18.3.0.52. 
Could you please check with 18.3.0.52 package version, and get back to us, if you need any further assistance on this. 
Regards, 
Aravinthan S. 



JT Joseph Tan December 4, 2020 07:58 PM UTC

Hi There,

I upgraded to 18.3.52 and the reported problem has gone away.

However, there is a new problem that occurs with this version. 

Sometimes, on opening the menu, the following exception is thrown: 


[08:45:27 ERR] Unhandled exception in circuit 'Mo8cD6pHW2wnaJC-uTWyz9-cX1-uxUv4zkkLj5atiM8'.
System.AggregateException: One or more errors occurred. (Index was out of range. Must be non-negative and less than the size of the collection. (Parameter 'index'))
 ---> System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection. (Parameter 'index')
   at Syncfusion.Blazor.Navigations.SfMenu`1.SetPosition(String name)
   at Syncfusion.Blazor.Navigations.SfMenu`1.BeforeOpenHandler[T](BeforeOpenCloseMenuEventArgs`1 e)
   at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task)
   at Syncfusion.Blazor.Internal.SfBaseUtils.InvokeEvent[T](Object eventFn, T eventArgs)
   at Syncfusion.Blazor.Navigations.Internal.SfMenuBase`1.TriggerBeforeOpenCloseEvent[T](T parentItem, List`1 subItems, String name, Boolean isParent, Double left, Double top)
   at Syncfusion.Blazor.Navigations.SfContextMenu`1.OnAfterRenderAsync(Boolean firstRender)
   --- End of inner exception stack trace ---


Here is a video of this happening : https://drive.google.com/file/d/1BMuAV3w1UmbAMxVhV5xagrwsv7t946iJ/view?usp=sharing



AS Aravinthan Seetharaman Syncfusion Team December 8, 2020 05:11 PM UTC

Hi Joseph Tan, 
  
We have checked your reported issue, and we cannot reproduce the issue in our end. 
Could you please get back to us with issue replicable sample/code snippet, based on that we will check and provide you a better solution quickly.  
   
Regards,  
Aravinthan S. 



JT Joseph Tan December 10, 2020 06:00 AM UTC

Attached is a solution where the problem occurs. 

Navigate to the "Menu" item, run your cursor over the menu. Exception occurs. (you may have to try this more than once)

Video: https://drive.google.com/file/d/1pkJ7MIJxURAkii5frfgAxlH4G5nn6ifY/view?usp=sharing

Attachment: SfMenu200513417JT_f362f14c.zip


JT Joseph Tan December 12, 2020 06:44 AM UTC

Any updates?


MK Mohan Kumar Ramasamy Syncfusion Team December 14, 2020 10:56 AM UTC

Hi Joseph, 
 
Sorry for the inconvenience caused. 
 
We have checked your reported query. We can reproduce the reported issue in our end. We have logged an issue report for this, and we will include this fix in our upcoming patch release which will be scheduled on 30th December 2020 and appreciate your patience until then. You can track the status of this bug using below link.  
 
 
Regards, 
Mohan kumar R 


Marked as answer
Loader.
Up arrow icon