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

Can't render chart in code behind #488

Closed ismaelestalayo closed 3 years ago

ismaelestalayo commented 3 years ago

Description

I need to be able to render a chart in a Background Task to save it as a PNG and show it on my live tile. But for some reason, despite being able to render Grids and TextBlocks created purely in code behind, I'm unable to do the same with a Telerik Chart with the following error:

image

Steps to Reproduce

  1. Create a Background Task in a UWP project.
  2. Try to render a Telerik Chart created in C#

Expected Behavior

The newly created empty chart should render correctly.

Actual Behavior

AccessViolationException

Basic Information

APopatanasov commented 3 years ago

Hi @ismaelestalayo,

I will need some more information in order to be able to reproduce the described issue. Could you please, provide a sample project that demonstrates the issue, so I can investigate it further?

Thanks in advance.

ismaelestalayo commented 3 years ago

Sorry it took me so long to reply. I've uploaded a very basic project that reproduces my issue here: https://github.com/ismaelestalayo/Telerik-Issues

After launching the app, you first need to manually fire the registered background task image

After that, you can check that it can succesfullly render off-screen a Grid, but it breaks when rendering any Telerik chart.

APopatanasov commented 3 years ago

@ismaelestalayo I can't open the provided link of the repository where the issue can be reproduced. Can you please check it?

ismaelestalayo commented 3 years ago

@ismaelestalayo I can't open the provided link of the repository where the issue can be reproduced. Can you please check it?

My bad, forgot that repos are private by default. Should be fixed now.

APopatanasov commented 3 years ago

@ismaelestalayo Using the provided solution I was able to reproduce the described exception. After further investigating it I noticed that actually the exception can be reproduced with every control part of the Telerik UI for UWP repository. That was something I found very curious and because of it I have done some testing outside of the Telerik UI for UWP scope. After testing with controls from the WindowsCommunityToolkit and other 3rd party control venders the exact same exception was observed with their controls as well.

Screenshot 2021-04-07 at 18 46 17

As I cannot tell why exactly the RenderTargetBitmap cannot render any 3rd party control I suggest you to consider looking for help on StackOverflow and Microsoft Q and A.