Converting a LOB W8.1 app to W10 – Part 4

And we’re back with more changes between W10 and W8.1 apps.

‘Random’ error
I’m getting a series of ‘random’ crashes on one of our screens.

One of the errors I’m seeing is some rubbish about an error 0xC0000602 in Windows.UI.Xaml.

I’ve read that this error could be occuring from IValueConverters that returned an incorrect value. E.g. returning a Color when a Brush is expected. But, same as before, I have no clue as to where precisely this error is occurring…

Some suggested to put the debugger in mixed mode (it was in “Managed Only”), but that gave me many errors from the moment the app started, like:

Exception thrown at 0x75063E28 (KernelBase.dll) in OurNamespace.Windows.exe: 0x40080201: 
WinRT originate error (parameters: 0x8000000B, 0x00000040, 0x0078E568).

A quick google suggests looking in the memory banks for that last parameter. You can do this via the contextmenu Debug –> Windows –> Memory –> Memory1. Paste the address here and check the message:
Now if only I knew what threw that error >_>

I decided to ignore these other errors, and just focus on the first one (on that one specific page). Now, to find it, I’ve commented my entire xaml, and uncommented piece by piece until we find where the error occurs.

I’m not entirely sure why, but I think I found it:
On that page, we have a three hubs, and a VisualStateManager that shows one of these hubs at a time.
However, in the initial state of these hubs, they are visible. I think that, because of some binding that’s failing because the data isn’t loaded yet, this error was thrown. (I didn’t bother to find out which binding it was, as long as it works ;))

After a bit, I was able (woohoo) to get the error again…
According to a reply on this forum post, the problem could be that the visibility of certain items is being changed by multiple threads at the same time. Simply adding a

await Task.Delay(200);

should do the trick.
This seems to work for me, if anybody has a better idea, please do let me know 🙂

Checkbox’ MinWidth
It seems that CheckBoxes suddenly have a minwidth of 120. I’m not sure if this comes from W10 or from something else. But after adding the following generic style, this problem is no more 🙂

Custom styles
If you edited templates of basic controls, it’s advised that you grab the new template from the W10 kit and apply your changes to that. You could just edit your existing templates, but IMHO that would be a lot more work to get everything working…
There’s also the added bonus that Microsoft did some work on simplifying these templates :).

You can find the base templates on your own disc:

C:\Program Files (x86)\Windows Kits\10\DesignTime\CommonConfiguration\Neutral\UAP\10.0.10240.0\Generic\generic.xaml