There are days where technology seems to be against you, yesterday was one of those.
It all started in the morning when I inadvertently pressed the sleep button on my Logitec keyboard and my notebook gone into sleep mode, something i do often indeed, but this time it was different because at resume all i got was a black screen. Since this happened a couple of times in the past I switched it off hoping to solve it soon, but after machine boot the black screen was still there. A voice inside of me started saying “is gonna be a hard day…”, so i started, without much faith honestly the: boot, safe mode, repair, try restore point ritual but, as always happened in my personal experience, without luck.
Since I really hate repaving my work machine, I’m a bit paranoid with backups: I do backup at least once/twice a week and before any important update. so I inserted the USB recovery key of my favorite’s backup tool: Acronis True Image and started a sector-by-sector restore of July 28th backup.
After a while my notebook was brought back to life, and nobody will ever know what happened on this bright July 30th morning, but who cares, it’s time to go back coding…
Since I’m working on a Windows Store app that interacts with Facebook I started digging into Facebook SDK documentation and in short time I wrote a test app that logins and retrieves user profile.
Time to test the code: I lanched the app, the login dialog appeared and successfully logged in, but, wait, there’s a an issue: the breakpoint I added to read the returned token didn’t fired and application seems never returning from Login method.
Ok, let’s find what’s wrong but starting from Facebook developer registration down to code everything looks fine.
Let’s try an old sample I wrote in the past I know was ok: same problem.
Let’s use WebAuthenticationBroker sample from Developer portal, it must work!: well it wasn’t.
Since I lost any idea I asked my friend @CristianCivera some hints and you can image my face when after some pair debugging he told me: “Know what? the sample works on my machine”
Below my face as soon as I read the message:
Just to be 100% sure I started a remote debugging session with my tablet and everything was working as expected.
I started to getting nervous since I had no idead why that call wasn’t working on my PC.
While trying to find a solution i thought: And if problem isn’t in just WebAuthenticationBroker but in all async methods? So I opened the FilePicker example from Windows Store dev portal, launched it and put a breakpoint on yellow line:
Result: I can select the file, breakpoint doesn’t fire anyway, but now Visual Studio reports an exception:
The remote procedure call failed. (Exception from HRESULT: 0x800706BE)"}
a search on Interned pointed me to several possible solutions but none was the right one, looks like async call for unknown reason never returns, even launching the standalone app..
I started realizing that can’t work on any Windows Store app until I get this fixed and wondered: Why didn’t got into this before?, I spend the day between async/await and breapoints always worked.
Tried another Windows Store app that uses async/await and breakpoints worked, so why some async calls raise the exception and others don’t?
After long thinking I realized that both OpenPicker.PickSingleFileAsync() and WebAuthenticationBroker.LoginAsync() deal with UI, former opens file selection while latter displays a dialog, so I started thinking about graphic drivers (don’t ask me why, maybe someone took pity on me…) so I updated my NVidia driver and restarted.
No way, problem still there…
Before starting to tear my hair (and remind me that I do not have…) i remembered that I also have a USB video driver that controls my 3rd monitor: A quick check and saw that it driver was outdated, so i installed the recent one. Rebooted the machine launched the sample and…
YESSSSSS!!! The problem gone! probably something in the driver was conflicting with WinRT causing the exception thus preventing the call to return.
To recap this long post: If your async calls seems not to return and you get weird: The remote procedure call failed. (Exception from HRESULT: 0x800706BE)" message: check your video drivers.
If all this sound unbeliveable, you’re right, IT IS! (while true…)
Hope this will save you working hours (and hairs) in future.
There are some cases where you need to identify a precise Windows 8 device (imagine a subscription that’s locked to a specific machine), in Windows Phone you could use:
Microsoft.Phone.Info.DeviceExtendedProperties.GetValue( "DeviceUniqueId" );
Unfortunately that was not available in WinRT but good new is that capability has been added into final release:
is all you need to get the identifier tied to a machine.