Skip to content
This repository has been archived by the owner on Jun 10, 2024. It is now read-only.

Conditional Operator in ExpressionAnimation causing system crashing error #19

Closed
JustinXinLiu opened this issue Feb 16, 2016 · 9 comments
Assignees
Labels

Comments

@JustinXinLiu
Copy link

A couple of days ago I pushed an animated Tab control to GitHub and it was built in the last Windows 10 Insider build 14527. As you swipe left or right on the control, the headers are fade in/out accordingly and the header underline follows the selected header too. Yes, it's made with Composition. I really like it. :)

Today when I tried to run the project on the same touch-enabled machine, as soon as I did a swipe on the control, the whole Windows 10 OS went black. After a couple of minutes it came back to life but the machine seemed to be restarted and the resolution was set to the lowest, so I thought this might just be a video card failure and shouldn't have anything to do with the project.

I was wrong. The machine just kept crashing as soon as I touched the control. I then tried it on my phone (build 10.0.10586.107), same result - the phone just restarted.

This might have something to do with the any of the following updates that are installed in the last couple of days, I'm not 100% sure.

update history

After spending a couple of hours debugging, I managed to make the crash go away, on both my PC and phone. However, I am not exactly sure what's causing this. This could be a build issue but I was using the same build when I developed it and it was working fine.

Anyway, this is what I've found -

If you use Conditional Operator Expression (i.e. ? & :) inside your Expression, you have to make sure that you wrap any expression that has more than one members with round brackets ((...)).

For example,

  • (A < 0) ? (B + C) : (B + D) works fine on both PC and phone.
  • A < 0 ? B + C : B + D crashes on both PC and phone.

Hopefully this can help you guys narrow down the issue!

@tomzorz
Copy link

tomzorz commented Feb 16, 2016

Can confirm, same happens here. (Tested on Lumia 950, latest stable (not-insider) OS version.)

@pgills pgills added the bug label Feb 16, 2016
@pgills
Copy link
Contributor

pgills commented Feb 16, 2016

Thanks @JustinXinLiu @tomzorz. We'll get some folks to take a look at it.

Just to clarify:

Found on build(s): 10586, 14527
Repo Steps:

  1. Create an ExpressionAnimation with Conditional Operator Expression without parenthesis (like you have above)
  2. Play the ExpressionAnimation on a Visual

Expected Results:
ExpressionAnimation runs conditionally.

Actual Results:
Screen goes black and feels like a video card failure.

@pgills pgills changed the title System crashing error Conditional Operator in ExpressionAnimation causing system crashing error Feb 16, 2016
@JustinXinLiu
Copy link
Author

Yes that's right thanks @pgills!

@patsiu
Copy link
Member

patsiu commented Feb 18, 2016

Hey @JustinXinLiu!

Sorry for the delay on getting back to you on this. We have a hunch on what you're running into - to verify, can you try the following out for us: In your ternary operator, remove the parentheses you added in to make it work and add in your condition portion a sequence of nested 0's such as [...] + (0 + (0 + (0 + (0 + (0+0))))). (The more complex your "if true" and "if false" portions are, increase the number of nested 0's in the condition)

So in your example above, it will look like A < 0 + (0 + (0 + (0 + (0 + (0+0))))) ? B + C: B + D.

Let us know what happens. Thanks!

@JustinXinLiu
Copy link
Author

@patsiu you guys must have found the issue! After I added (0 + (0 + (0 + (0 + (0 + 0))))) to all the conditional portions both my phone and PC are working. 👍

@patsiu
Copy link
Member

patsiu commented Feb 18, 2016

Awesome - thanks for verifying @JustinXinLiu !

We have a fix for this issue, which will come in a future insider build. Until then, use the nested 0's model as a temporary workaround (especially with more complex ternary operators).

@JustinXinLiu
Copy link
Author

Sure thanks guys! I will close the issue once the new build comes out.

@JustinXinLiu
Copy link
Author

Hey guys looks like the issue has been fixed in build 14267? I just updated my PC and it no longer crashes. So I am closing it now.

@pgills
Copy link
Contributor

pgills commented Feb 19, 2016

Thanks @JustinXinLiu.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants