telerik / UI-For-UWP

This repo contains the source code for Telerik UI for Universal Windows Platform (UWP), which includes 20+ UI controls for developers building UWP applications.
http://www.telerik.com/uwp/
Other
1.16k stars 234 forks source link

Using RadPaginationControl produces a "Catastrophic failure" #254

Open SuperJMN opened 6 years ago

SuperJMN commented 6 years ago

I'm getting a catastrophic failure that is absolutely related with the RadPaginationControl.

To reproduce the issue, please clone this project:

  1. https://github.com/SuperJMN/Inventory.git
  2. Switch to the "catastrophic" branch
  3. Run the app (it's a Windows Universal application that needs Fall Creators Update)
  4. Click on the "Orders" tab at the bottom part.
  5. On the Customers list, keep clicking on the paginator to switch pages
  6. BOOM!!!

How do I know that it's because of the RadPaginationControl?

Easy :) Becase the problem disappears as soon as I comment the 2 RadPaginationControls that are used in the application: They are inside CustomersListControl and in OrderListControls.

Please, take a look to it. Thank you!

APopatanasov commented 6 years ago

@SuperJMN Thanks for the provided project. I have made a small research what might be causing such type of exception and found that it could be a result of the compilation of the code. Could you please, try to set the following tag into your Inventory.Uwp.csproj and let me know if the exception still occurs: ` ...

false

`

SuperJMN commented 6 years ago

@APopatanasov Sorry, I've set the property in the Inventory.Uwp.csproj in both x86 and x64 versions (I'm debugging using the x64 version) and it produces the same result.

Have you been able to reproduce it?

APopatanasov commented 6 years ago

@SuperJMN Yes, I was able to reproduce the issue and actually it gets resolved by setting the mentioned optimization.

However, as it is not working on your side I will need some more time to investigate it further. I will try to isolate the issue in a smaller sample project. If you find something else that could help with the investigation do not hesitate to contact me.

APopatanasov commented 6 years ago

@SuperJMN I have tried several approaches to isolate the issue outside of the provided application but without any luck. Due to the complexity of the provided project I could not tell for sure what might be the reason for the observed behavior.

As the PaginationControl works as expected when the Orders tab is not selected (when there is only one PaginationControl visible) I believe that there might be something specific in the implementation that is causing the exception. I have noticed there are several places where the data is asynchronously loaded and there might be a timing issue that makes the control breaks while the data is loading.

Due to the fact that I am not able to tell for sure whether the problem is caused by the implementation of the application and the way the application uses the control or by the control itself I cannot provide any solution. If you provide a simple application that demonstrates the issue I will be glad to investigate it further and provide you more detailed information.

SuperJMN commented 6 years ago

I’m very sorry to hear that you haven’t been able to fix it. The application is really simple, indeed. The asynchronous loading occurs on the UI Thread, son it think it’s not a concurrency problem. Then, it think the issue would likely happen anyways. If you take a look at the code, the mechanism that I use to load things on demand is Interaction Behaviors. I map an Events to Commands. The interesting part is here:

https://github.com/SuperJMN/Inventory/blob/catastrophic/Inventory/Views/Customers/CustomersView.xaml#L37

As you see, I'm just launching the command whenever the DataContext changes to make sure this command that loads the Orders is invoked every time the user changes.

It doesn't have any complex logic. No tricks or code-behind in any view. I'm almost sure that the PaginationControl has some problem. Have you tried to debug with the actual code, not the NuGet package? maybe you will get more information instead only the "catastrophic" message.

Good luck!

APopatanasov commented 6 years ago

@SuperJMN I went deep into your project with attached source code to it (not using the package) and still only "Catastrophic failure" exception is thrown. The approach looks really straight forward. Internally the PaginationControl uses ListBox inside its Template and while doing a research I have found that such exception could be observed when the ItemsSource of a control that derives from the ListBox is changed. These findings point me to the direction that the approach used for loading the source for the PaginationControl could be causing the issue.

Unfortunately, I was not able to prove these findings and because of that I am not able to continue my investigation. If you have any additional information that could help the investigation to continues please, let me know.