<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="https://www.w3.org/2005/Atom" xmlns:sy="https://purl.org/rss/1.0/modules/syndication/" xmlns:dc="https://purl.org/dc/elements/1.1/" xmlns:content="https://purl.org/rss/1.0/modules/content/" xmlns:wfw="https://wellformedweb.org/CommentAPI/" xmlns:slash="https://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>Windows Store Developer Solutions</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/wsdevsol/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/wsdevsol/feed.xml</link>
    <description>Information + Context = Solution</description>
    <lastBuildDate>Wed, 14 Feb 2018 21:43:22 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>Why can't I deploy my UWP app with .Net Standard 2.0 to a Mobile device or emulator?</title>
      <link>https://docs.microsoft.com/archive/blogs/wsdevsol/why-cant-i-deploy-my-uwp-app-with-net-standard-2-0-to-a-mobile-device-or-emulator</link>
      <pubDate>Wed, 14 Feb 2018 21:43:21 GMT</pubDate>
      <dc:creator><![CDATA[Rob Caplan [MSFT]]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/wsdevsol/?p=1615</guid>
      <description><![CDATA[Several developers have been confused recently because they created new UWP apps using .Net Standard...]]></description>
      <content:encoded><![CDATA[Several developers have been confused recently because they created new UWP apps using .Net Standard 2.0 and then weren't able to deploy the app to their Windows 10 Mobile devices.  Additionally, when trying to use the emulator, no debug targets show up in Visual Studio 2017.

<strong>UWP apps do not support .Net Standard 2.0 on Windows 10 Mobile</strong>

This behavior is expected.   Support for <a href="https://blogs.msdn.microsoft.com/dotnet/2017/10/10/announcing-uwp-support-for-net-standard-2-0/">.Net Standard 2.0 was introduced in 1709 (build 16299) of Windows 10.</a>   The current latest version of Windows 10 Mobile is 15254, which does not have the full API set of 1709.  As the above post explains:
<blockquote>That’s because .NET Standard 2.0 contains many APIs that require FCU to make them work in the context of the UWP execution environment, specifically AppContainer.</blockquote>
When a developer attempts to deploy from Visual Studio to a fully updated Windows 10 Mobile device, the IDE will give the following error:
<blockquote>
<pre>Error DEP3321: To deploy this application, your deployment target should be running Windows Universal Runtime version 10.0.16299.0 or higher. You currently are running version 10.0.15254.158. Please update your OS, or change your deployment target to a device with the appropriate version</pre>
</blockquote>
At the time of this post, the only solutions are:
<ul>
 	<li>Reduce the app's minimum target version (which will have the effect of removing .Net Standard 2.0 support)</li>
 	<li>Switch the deployment target to a non-Mobile device.</li>
</ul>
Developers who want to keep updating features for their Windows 10 Mobile apps may need to avoid .Net Standard 2.0.  Within the application itself, a developer can utilize the <a href="https://docs.microsoft.com/en-us/uwp/api/Windows.Foundation.Metadata.ApiInformation">Windows.Foundation.Metadata.ApiInformation</a> class to ensure that a new API exists and is available for the target platform before calling it and reverting to older functionality if the new functionality isn't available.

Developers can also fork their builds into a .Net Framework 2.0 branch which targets newer functionality on Fall Creators Update systems with min version 16299 and a pre-.Net Framework 2.0 branch to run on devices (including Mobile) whose users haven't updated to 16299.

<strong>Xamarin</strong>

Current versions of Xamarin offer choices of a shared project (fine for Windows 10 Mobile) or a .Net Standard 2.0 project (replacing the previous PCL option). To target Windows 10 Mobile either use the shared project or open your .Net Standard project properties and downgrade it to .Net Standard 1.4. In either case, open your UWP project and set its Min version to 15254 or lower to run on Windows 10 Mobile.]]></content:encoded>
    </item>
    <item>
      <title>ComboBox on a Flyout attached to an AppBarButton loses mouse input on 1607</title>
      <link>https://docs.microsoft.com/archive/blogs/wsdevsol/combobox-from-an-appbarbutton-loses-mouse-input-on-1607</link>
      <pubDate>Wed, 14 Sep 2016 05:02:18 GMT</pubDate>
      <dc:creator><![CDATA[Rob Caplan [MSFT]]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/wsdevsol/?p=1595</guid>
      <description><![CDATA[Several developers have asked why a ComboBox on a Flyout attached to an AppBarButton ignores mouse...]]></description>
      <content:encoded><![CDATA[Several developers have asked why a ComboBox on a Flyout attached to an AppBarButton ignores mouse clicks after upgrading their UWP apps to target build <span>14393 (Windows 10, version 1607 – also known as the Windows 10 Anniversary Update)</span>. The same Xaml worked fine unchanged when the app targeted build 10586 <span>(Windows 10, version 1511)</span>.

<strong>&lt;tl;dr&gt;</strong>

Apps can reenable focus here by setting the AppBarButton's <a href="https://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.xaml.frameworkelement.allowfocusoninteraction">AllowFocusOnInteraction</a> property to true.
<div><span style="font-family: 'Times New Roman', serif;font-size: medium"><span><span style="color: #333333;font-family: Georgia, serif"><b>Why is this happening?</b></span></span></span></div>
The new behavior is a side effect of the new focus system which allows users to interact with controls such as AppBarButtons without stealing the focus from the control they're trying to modify. This has been a huge request from devs whose apps have scenarios such as text editors: the app can have formatting buttons (e.g. bold, italic, colors) which change the formatting without affecting the text's focus or selection.

The new behavior enhances the common AppBarButton use case so AppBarButtons default to AllowFocusOnInteraction to false if the app opts in to new behavior by targeting build 14393.

In the case where the AppBarButton brings up a ComboBox, the ComboBox depends on being able to get the focus. For this case the app needs to override the default and explicitly set AllowFocusOnInteraction to true.

<b>How do I let the ComboBox get focus?</b>

If you just fired up your app in Visual Studio and added AllowFocusOnInteraction to the AppBarButton Xaml you probably discovered that the editor rejected it. AllowFocusOnInteraction is only available in build 14393 and later. If the app's minimum version is lower than that then it can't be used in version flexible Xaml.

<strong>Set in code behind with adaptive code</strong>

The standard pattern to set properties that may or may not exist is to check if it's present with the <a href="https://msdn.microsoft.com/library/windows/apps/dn949001">Windows.Foundation.Metadata.ApiInformation</a> class:
<div style="overflow: auto;width: auto;font-family: Consolas">
<pre><span style="color: blue">private void </span>AppBarButton_Loaded(<span style="color: blue">object</span> sender, <span style="color: darkcyan">RoutedEventArgs</span> e)
{
    <span style="color: blue">bool</span> allowFocusOnInteractionAvailable = 
        Windows.Foundation.Metadata.<span style="color: darkcyan">ApiInformation</span>.IsPropertyPresent(
            <span style="color: brown">"Windows.UI.Xaml.FrameworkElement"</span>, 
            <span style="color: brown">"AllowFocusOnInteraction"</span>);

    <span style="color: blue">if</span> (allowFocusOnInteractionAvailable)
    {
        <span style="color: blue">var</span> s = sender <span style="color: blue">as</span> <span style="color: darkcyan">FrameworkElement</span>;
        <span style="color: blue">if</span> (s != <span style="color: blue">null</span>)
        {
            s.AllowFocusOnInteraction = <span style="color: blue">true</span>;
        }
    }
}
</pre>
</div>
<strong>Set in Xaml via an Attached Property</strong>
<div>If we don't want to set this directly from code-behind we can bring the adaptive code back to Xaml by exposing it as an attached property. This property can be set on any AppBarButton (&amp;c) we want to set AllowFocusOnInteraction on regardless of version. If AllowFocusOnInteraction is available then the property will set it. If not, then it's a no-op.</div>
<div></div>
<div style="overflow: auto;width: auto;font-family: Consolas">
<pre><span style="color: blue">public class</span> <span style="color: darkcyan">CompatExtensions</span>
{
    <span style="color: blue">public static bool</span> GetAllowFocusOnInteraction(<span style="color: darkcyan">DependencyObject</span> obj)
    {
        <span style="color: blue">return</span> (<span style="color: blue">bool</span>)obj.GetValue(AllowFocusOnInteractionProperty);
    }
    <span style="color: blue">public static void</span> SetAllowFocusOnInteraction(<span style="color: darkcyan">DependencyObject</span> obj, <span style="color: blue">bool</span> value)
    {
        obj.SetValue(AllowFocusOnInteractionProperty, <span style="color: blue">value</span>);
    }
    <span style="color: green">// Using a DependencyProperty as the backing store for AllowFocusOnInteraction.  
    // This enables animation, styling, binding, etc...</span>
    <span style="color: blue">public static readonly</span> <span style="color: darkcyan">DependencyProperty</span> AllowFocusOnInteractionProperty =
        <span style="color: darkcyan">DependencyProperty</span>.RegisterAttached(<span style="color: brown">"AllowFocusOnInteraction"</span>, 
                                            <span style="color: blue">typeof</span>(<span style="color: blue">bool</span>),
                                            <span style="color: blue">typeof</span>(<span style="color: darkcyan">CompatExtensions</span>),
                                            <span style="color: blue">new</span> <span style="color: darkcyan">PropertyMetadata</span>(0, AllowFocusOnInteractionChanged));

    <span style="color: blue">private static bool</span> allowFocusOnInteractionAvailable = 
        Windows.Foundation.Metadata.<span style="color: darkcyan">ApiInformation</span>.IsPropertyPresent(
            <span style="color: brown">"Windows.UI.Xaml.FrameworkElement"</span>, 
            <span style="color: brown">"AllowFocusOnInteraction"</span>);
    <span style="color: blue">private static void</span> AllowFocusOnInteractionChanged(<span style="color: darkcyan">DependencyObject</span> d, <span style="color: darkcyan">DependencyPropertyChangedEventArgs</span> e)
    {
        <span style="color: blue">if</span> (allowFocusOnInteractionAvailable)
        {
            <span style="color: blue">var</span> element = d <span style="color: blue">as</span> <span style="color: darkcyan">FrameworkElement</span>;
            <span style="color: blue">if</span> (element != <span style="color: blue">null</span>)
            {
                element.AllowFocusOnInteraction = (<span style="color: blue">bool</span>)e.NewValue;
            }
        }
    }
}
</pre>
</div>
And then set the property in Xaml without worrying about the app version:
<div style="overflow: auto;width: auto;font-family: Consolas;color: blue">
<pre>&lt;<span style="color: brown">AppBarButton</span> <span style="color: red">local:CompatExtensions.AllowFocusOnInteraction</span>="True" <span style="color: red">Icon=</span>"Setting"&gt;
    &lt;<span style="color: brown">AppBarButton.Flyout</span>&gt;
        &lt;<span style="color: brown">Flyout</span>&gt;
            &lt;<span style="color: brown">StackPanel</span> <span style="color: red">Orientation=</span>"Vertical" &gt;
                &lt;<span style="color: brown">ComboBox</span>&gt;
                    &lt;<span style="color: brown">ComboBoxItem</span> <span style="color: red">Content</span>="Red" <span style="color: red">IsSelected=</span>"True" /&gt;
                    &lt;<span style="color: brown">ComboBoxItem</span> <span style="color: red">Content</span>="Green" /&gt;
                    &lt;<span style="color: brown">ComboBoxItem</span> <span style="color: red">Content</span>="Blue"/&gt;
                &lt;/<span style="color: brown">ComboBox</span>&gt;
            &lt;/<span style="color: brown">StackPanel</span>&gt;
        &lt;/<span style="color: brown">Flyout</span>&gt;
    &lt;/<span style="color: brown">AppBarButton.Flyout</span>&gt;
&lt;/<span style="color: brown">AppBarButton</span>&gt;
</pre>
</div>]]></content:encoded>
    </item>
    <item>
      <title>Windows Store app projects stopped generating the .appxupload file after installing VS 2015 Update 1</title>
      <link>https://docs.microsoft.com/archive/blogs/wsdevsol/windows-store-app-projects-stopped-generating-the-appxupload-file-after-installing-vs-2015-update-1</link>
      <pubDate>Fri, 08 Jan 2016 17:15:00 GMT</pubDate>
      <dc:creator><![CDATA[Abdulwahab Suleiman]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/wsdevsol/2016/01/08/windows-store-app-projects-stopped-generating-the-appxupload-file-after-installing-vs-2015-update-1/</guid>
      <description><![CDATA[Problem
A few people have noticed that their Windows Store app projects stopped generating the...]]></description>
      <content:encoded><![CDATA[<p><span style="font-family: times new roman,times; font-size: medium;"><strong>Problem</strong></span></p>
<p><span style="font-family: times new roman,times; font-size: small;">A few people have noticed that their Windows Store app projects stopped generating the .appxupload file after upgrading to VisualStudio 2015 Update 1.</span></p>
<p>&nbsp;</p>
<p><strong><span style="font-family: times new roman,times; font-size: medium;">Cause</span></strong><br /><span style="font-family: times new roman,times; font-size: small;">The project is not associated with the Store app.</span><br /><span style="font-family: times new roman,times; font-size: small;">The StoreAssociation file path is missing from the respective project .csproj file.</span></p>
<p><span style="font-family: times new roman,times; font-size: small;">Either one of these causes listed above can stop the appxupload file from being generated. This is because msbuild tries to find the Package.StoreAssociation.xml file in the project using the path specified in the respective project .csproj file.</span></p>
<p><em><strong><span style="font-family: times new roman,times; font-size: small;">Extract from MSBuild log showing working and failing scenarios:</span></strong></em></p>
<ul>
<li><span style="font-family: times new roman,times; font-size: small; background-color: #ffff00;">Failing scenario:</span></li>
</ul>
<p style="padding-left: 60px;"><span style="font-family: times new roman,times; font-size: small;">Notice that (<a href="mailto:'@(StoreAssociationFile)'">'@(StoreAssociationFile)'</a> != '') was evaluated as (<span style="background-color: #ffff00;">'' != ''</span>). Which means the StoreAssociation file was never found.</span></p>
<p style="padding-left: 60px;"><span style="font-family: courier new,courier; font-size: x-small;">Task "Warning" skipped, due to false condition; (('$(_ExtractPlatforms)' == 'true' and <a href="mailto:'@(StoreAssociationFile)'">'@(StoreAssociationFile)'</a> == '' and '$(AppxBundlePlatforms)' == '')</span><br /><span style="font-family: courier new,courier; font-size: x-small;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; or ('$(_ExtractPlatforms)' == 'true' and <a href="mailto:'@(StoreAssociationFile)'">'@(StoreAssociationFile)'</a> != '' and '$(_Platforms)' == '')) was evaluated as (('false' == 'true' and '' == '' and 'x86|arm' == '')</span><br /><span style="font-family: courier new,courier; font-size: x-small;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; or ('false' == 'true' and <span style="background-color: #ffff00;">'' != '' and '' == ''</span>)).</span></p>
<p>&nbsp;</p>
<ul>
<li><span style="font-family: times new roman,times; font-size: small;"><span style="background-color: #ffff00;">Working scenario</span>:&nbsp;</span></li>
</ul>
<p style="padding-left: 60px;"><span style="font-family: times new roman,times; font-size: small;">Notice that (<a href="mailto:'@(StoreAssociationFile)'">'@(StoreAssociationFile)'</a> != '') was evaluated as (<span style="background-color: #ffff00;">'Package.StoreAssociation.xml' != ''</span>). Which means the StoreAssociation file&nbsp;was found and evaluated correctly.</span></p>
<p style="padding-left: 60px;"><span style="font-family: courier new,courier; font-size: x-small;">Task "Warning" skipped, due to false condition; (('$(_ExtractPlatforms)' == 'true' and <a href="mailto:'@(StoreAssociationFile)'">'@(StoreAssociationFile)'</a> == '' and '$(AppxBundlePlatforms)' == '')</span><br /><span style="font-family: courier new,courier; font-size: x-small;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; or ('$(_ExtractPlatforms)' == 'true' and <a href="mailto:'@(StoreAssociationFile)'">'@(StoreAssociationFile)'</a> != '' and '$(_Platforms)' == '')) was evaluated as (('false' == 'true' and 'Package.StoreAssociation.xml' == '' and 'x86|arm' == '')</span><br /><span style="font-family: courier new,courier; font-size: x-small;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; or ('false' == 'true' and <span style="background-color: #ffff00;">'Package.StoreAssociation.xml' != '' and '' == ''</span>)).</span></p>
<p style="padding-left: 60px;">&nbsp;</p>
<p><span style="font-family: times new roman,times; font-size: medium;"><strong>Solution</strong></span></p>
<p><span style="font-family: times new roman,times; font-size: small;">To successfully generate the .appxupload file we require the following:</span></p>
<ul>
<li><span style="font-family: times new roman,times; font-size: small;">The project must be associated with the </span><span style="font-family: times new roman,times; font-size: small;">Store app (Project &gt; Associate with Store&hellip;) or use packaging wizard, and </span><span style="font-family: times new roman,times; font-size: small;">select &lsquo;Yes&rsquo; when asked to associate the app with the store.</span></li>
<li><span style="font-family: times new roman,times; font-size: small;">Verify that the store association file </span><span style="font-family: times new roman,times; font-size: small;">is present in your project. The file needs to be present on disk and must be </span><span style="font-family: times new roman,times; font-size: small;">referenced in the appropriate .csproj; that&rsquo;s where we get the file path.</span></li>
<li><span style="font-family: times new roman,times; font-size: small;">The content type of the file must be </span><span style="font-family: times new roman,times; font-size: small;">set to &ldquo;None&rdquo; and should look like this in the .csproj file:</span></li>
</ul>
<p><span style="color: #ff0000; font-family: courier new,courier; font-size: small;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;ItemGroup&gt;</span><br /><span style="color: #ff0000; font-family: courier new,courier; font-size: small;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;None Include="Package.StoreAssociation.xml" /&gt;</span></p>
<p><span style="color: #ff0000; font-family: courier new,courier; font-size: small;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/ItemGroup&gt;</span></p>
<ul>
<li><span style="font-family: times new roman,times; font-size: small;"><span style="background-color: #ffff00;">The xml above is for verification purposes</span>. You shouldn't need to enter these values manually since it gets added automatically when you associate the app with the store.</span></li>
<li><span style="font-family: times new roman,times; font-size: small;">If using a build script, we recommend </span><span style="font-family: times new roman,times; font-size: small;">that you replace the flags &ldquo;AppxPackageIsForStore&rdquo; and </span><span style="font-family: times new roman,times; font-size: small;">&ldquo;BuildAppxUploadPackageForUap&rdquo; with the new flag </span><span style="font-family: times new roman,times; font-size: small;">&ldquo;<span style="background-color: #ffff00;">UapAppxPackageBuildMode=StoreUpload</span>&rdquo;</span></li>
<ul>
<li><span style="font-family: times new roman,times; font-size: small;">The BuildMode flag will set the other </span><span style="font-family: times new roman,times; font-size: small;">required flags and invoke the right validations (including checking for store </span><span style="font-family: times new roman,times; font-size: small;">association) to produce a .appxupload package.</span></li>
</ul>
</ul>]]></content:encoded>
    </item>
    <item>
      <title>VPN Network connections from Store apps running on Connected Standby devices are very slow</title>
      <link>https://docs.microsoft.com/archive/blogs/wsdevsol/vpn-network-connections-from-store-apps-running-on-connected-standby-devices-are-very-slow</link>
      <pubDate>Wed, 24 Jun 2015 09:03:00 GMT</pubDate>
      <dc:creator><![CDATA[Matt Small]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/wsdevsol/2015/06/24/vpn-network-connections-from-store-apps-running-on-connected-standby-devices-are-very-slow/</guid>
      <description><![CDATA[The title says it all: when you make a network connection from your Windows Store app to a resource...]]></description>
      <content:encoded><![CDATA[<p>The title says it all: when you make a network connection from your Windows Store app to a resource residing in your Virtual Private Network (VPN) using a device which supports <a href="https://msdn.microsoft.com/en-us/library/windows/hardware/dn481238(v=vs.85).aspx">Connected Standby</a>&nbsp;(also known as Always On/Always Connected [AOAC]), the connection may be very slow.&nbsp;</p>
<p>A network trace of a Windows Store app connecting to a resource residing inside the VPN will show an initial connection that goes out through the external network adapter, trying to get to the internal address but eventually failing.&nbsp; After the failure, there is a retry which then goes through the VPN and succeeds.&nbsp; The wait for failover is the cause of the latency, but the real problem is that it tries to connect via the external adapter. This&nbsp;issue only occurs with Windows Store apps.</p>
<p>The root cause of the problem is that devices which support Connected Standby try to use the AOAC-enabled adapter first for Store apps, in every case.&nbsp;&nbsp;A machine which is presently using AOAC&nbsp;<strong>and</strong> VPN will have at least two listed network adapters&nbsp;- at least one that performs the actual network connectivity operations (sending packets back and forth over the wire/wifi), and the VPN connection to the remote destination.&nbsp; There may be others, and they may also be negatively affected by this issue.&nbsp;</p>
<p>The problem is that&nbsp;the Store app always tries to first connect to a resource inside the VPN via the AOAC adapter, which will fail.&nbsp; Only after the failure occurs will the retry happen.&nbsp; In a default-configured network, the failure takes approximately 21 seconds:&nbsp;</p>
<ul>
<li>The first attempt at SYN, then timeout after 3 seconds.&nbsp;</li>
<li>The second attempt, then timeout after 6 seconds.&nbsp;</li>
<li>The third and final attempt, timeout at&nbsp;12 seconds.&nbsp; 3+6+12 = 21 seconds until&nbsp;the connection is aborted.</li>
<li>The&nbsp;VPN adapter is then tried, and it takes that time as well to get connected.</li>
</ul>
<p>An interesting thing about AOAC&nbsp;is that&nbsp;it does not work if HyperV is enabled on the machine, and that's how we can resolve this problem.&nbsp;Unfortunately,&nbsp;because there is no way to explicitly disable AOAC on a network adapter, you can enable HyperV which will disable AOAC and prevent the problem from occurring.&nbsp; More information here: <a href="https://answers.microsoft.com/en-us/surface/wiki/surfpro3-surfnetwork/work-around-for-surface-pro-3-issue-where/bd7c8bde-439b-45d6-8d9d-2776913e45e9">https://answers.microsoft.com/en-us/surface/wiki/surfpro3-surfnetwork/work-around-for-surface-pro-3-issue-where/bd7c8bde-439b-45d6-8d9d-2776913e45e9</a></p>
<p><strong>Steps to turn on Hyper-V:</strong></p>
<p style="margin-left: 30px;">1. Open an administrative command prompt and type:</p>
<p><strong><span style="color: #333333;">bcdedit /set hypervisorlaunchtype auto </span> </strong></p>
<p style="margin-left: 30px;"><span style="color: #333333;">2</span><span style="color: #333333;">.&nbsp; Restart your device</span></p>
<p style="margin-left: 30px;"><span style="color: #333333;">After restarting, Hyper-V will again be active (and Connected Standby will no longer function).&nbsp;</span></p>
<p><br />We've seen this issue reported with Surface Pro 3 since Connected Standby is default on that device.&nbsp; You also may find that this issue goes away after installing Visual Studio 2013.&nbsp; That's because Phone emulators are installed into HyperV,&nbsp;at which time&nbsp;HyperV is enabled, which causes AOAC to be disabled. Also, there is an active bug on this issue with the Windows Networking development team at the time of this blog post.&nbsp; We expect that this&nbsp;should be resolved in Windows 10.</p>
<p><br />Don&rsquo;t forget to follow the Windows Store Developer Solutions team on Twitter <a href="https://twitter.com/wsdevsol">@wsdevsol</a>. Comments are welcome, both below and on twitter.</p>
<p><br />&nbsp;&nbsp;&nbsp;&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>]]></content:encoded>
    </item>
    <item>
      <title>Implementing a Shake event on Windows Phone 8.1</title>
      <link>https://docs.microsoft.com/archive/blogs/wsdevsol/implementing-a-shake-event-on-windows-phone-8-1</link>
      <pubDate>Wed, 17 Jun 2015 07:30:00 GMT</pubDate>
      <dc:creator><![CDATA[Bret Bentzinger]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/wsdevsol/2015/06/17/implementing-a-shake-event-on-windows-phone-8-1/</guid>
      <description><![CDATA[function CopyCode(elemName) {
        var obj = document.getElementById(elemName);...]]></description>
      <content:encoded><![CDATA[<SCRIPT language=jscript>
    function CopyCode(elemName) {
        var obj = document.getElementById(elemName);
        window.clipboardData.setData("Text", obj.innerText);
    }
</SCRIPT>  <p>I was working in our MSDN Forums and found a post from a user trying to detect shake events for Windows Phone 8.1.&#160; I quickly realized this event is not built into the SDK, so I set out to create a helper class to raise a Shake event for Windows Phone 8.1.</p>  <p>The Accelerometer class in Windows Phone 8.1 has an event you can subscribe to that will be raised each time new data is available.&#160; This event is raised quite&#160; frequently to provide near real time data from the Accelerometer.&#160; I chose to poll for Accelerometer data because reading data in real time is not needed to detect a Shake event.&#160; The interval can be changed, but after trial and error I settled on&#160; 200ms.&#160; The class is written so you can configure the polling Interval, however&#160; I would not go greater than 200ms for the interval.&#160; The class also exposes a Threshold property which can be modified to configure the type of Shake motion needed to raise the event.</p>  <p>The below code is the class I implemented to detect and Raise Shake events.</p> <strong><a href="javascript:CopyCode('codesection1');">Copy Code:</a></strong>   <pre id="codesection1" class="code"><span style="background: white; color: blue">using </span><span style="background: white; color: black">System;
</span><span style="background: white; color: blue">using </span><span style="background: white; color: black">System.Collections.Generic;
</span><span style="background: white; color: blue">using </span><span style="background: white; color: black">System.Diagnostics;
</span><span style="background: white; color: blue">using </span><span style="background: white; color: black">System.Linq;
</span><span style="background: white; color: blue">using </span><span style="background: white; color: black">System.Text;
</span><span style="background: white; color: blue">using </span><span style="background: white; color: black">System.Threading;
</span><span style="background: white; color: blue">using </span><span style="background: white; color: black">System.Threading.Tasks;
</span><span style="background: white; color: blue">using </span><span style="background: white; color: black">Windows.Devices.Sensors;

</span><span style="background: white; color: blue">namespace </span><span style="background: white; color: black">PhoneShake
{
    </span><span style="background: white; color: blue">public class </span><span style="background: white; color: #2b91af">ShakeDetector
    </span><span style="background: white; color: black">{
        </span><span style="background: white; color: blue">public event </span><span style="background: white; color: #2b91af">EventHandler </span><span style="background: white; color: black">Shaken;
        </span><span style="background: white; color: #2b91af">Timer </span><span style="background: white; color: black">_timer;
        </span><span style="background: white; color: blue">protected static </span><span style="background: white; color: #2b91af">ShakeDetector </span><span style="background: white; color: black">_instance = </span><span style="background: white; color: blue">new </span><span style="background: white; color: #2b91af">ShakeDetector</span><span style="background: white; color: black">();
        </span><span style="background: white; color: blue">double </span><span style="background: white; color: black">_lastX;
        </span><span style="background: white; color: blue">double </span><span style="background: white; color: black">_lastY;
        </span><span style="background: white; color: blue">double </span><span style="background: white; color: black">_lastZ;
        </span><span style="background: white; color: blue">double </span><span style="background: white; color: black">_currentX;
        </span><span style="background: white; color: blue">double </span><span style="background: white; color: black">_currentY;
        </span><span style="background: white; color: blue">double </span><span style="background: white; color: black">_currentZ;
        
        </span><span style="background: white; color: blue">bool </span><span style="background: white; color: black">_bFirstUpdate;
        </span><span style="background: white; color: blue">bool </span><span style="background: white; color: black">_bShake;

        </span><span style="background: white; color: blue">protected void </span><span style="background: white; color: black">OnShaken(</span><span style="background: white; color: #2b91af">EventArgs </span><span style="background: white; color: black">e)
        {

            </span><span style="background: white; color: blue">if </span><span style="background: white; color: black">(Shaken != </span><span style="background: white; color: blue">null</span><span style="background: white; color: black">)
            {
                Shaken(</span><span style="background: white; color: blue">this</span><span style="background: white; color: black">, e);
            }
        }

        </span><span style="background: white; color: blue">protected </span><span style="background: white; color: black">ShakeDetector()
        {
            Interval = 200;
            Threshold = 3.00f;
            _bShake = </span><span style="background: white; color: blue">false</span><span style="background: white; color: black">;
            _bFirstUpdate = </span><span style="background: white; color: blue">true</span><span style="background: white; color: black">;
        }

        </span><span style="background: white; color: blue">public static </span><span style="background: white; color: #2b91af">ShakeDetector </span><span style="background: white; color: black">Instance
        {
            </span><span style="background: white; color: blue">get </span><span style="background: white; color: black">{ </span><span style="background: white; color: blue">return </span><span style="background: white; color: black">_instance; }
        }

        </span><span style="background: white; color: gray">/// &lt;summary&gt;
        /// </span><span style="background: white; color: green">Interval that we will use for shake.  Should probably not be &gt; 200ms
        </span><span style="background: white; color: gray">/// &lt;/summary&gt;
        </span><span style="background: white; color: blue">public int </span><span style="background: white; color: black">Interval { </span><span style="background: white; color: blue">get</span><span style="background: white; color: black">; </span><span style="background: white; color: blue">set</span><span style="background: white; color: black">; }
        </span><span style="background: white; color: gray">/// &lt;summary&gt;
        /// </span><span style="background: white; color: green">Force threshold to trigger Shaken event off of 
        </span><span style="background: white; color: gray">/// &lt;/summary&gt;
        </span><span style="background: white; color: blue">public double </span><span style="background: white; color: black">Threshold { </span><span style="background: white; color: blue">get</span><span style="background: white; color: black">; </span><span style="background: white; color: blue">set</span><span style="background: white; color: black">; }

        </span><span style="background: white; color: gray">/// &lt;summary&gt;
        /// </span><span style="background: white; color: green">Called to start monitoring for Shake Events.  Attach an event handler to shaken event before calling
        </span><span style="background: white; color: gray">/// &lt;/summary&gt;
        </span><span style="background: white; color: blue">public void </span><span style="background: white; color: black">Start()
        {
            </span><span style="background: white; color: green">//  Set up timer for interval
            </span><span style="background: white; color: black">_timer = </span><span style="background: white; color: blue">new </span><span style="background: white; color: #2b91af">Timer</span><span style="background: white; color: black">(IntervalTimer_Task, </span><span style="background: white; color: blue">null</span><span style="background: white; color: black">, 0, Interval);
   
            
        }

        </span><span style="background: white; color: gray">/// &lt;summary&gt;
        /// </span><span style="background: white; color: green">Called to stop monitoring and Firing Shake Events.
        </span><span style="background: white; color: gray">/// &lt;/summary&gt;
        </span><span style="background: white; color: blue">public void </span><span style="background: white; color: black">Stop()
        {
            </span><span style="background: white; color: green">//  Stop the timer
            </span><span style="background: white; color: black">_timer.Dispose();
            _timer = </span><span style="background: white; color: blue">null</span><span style="background: white; color: black">;

            _bFirstUpdate = </span><span style="background: white; color: blue">true</span><span style="background: white; color: black">;
        }

        </span><span style="background: white; color: blue">private void </span><span style="background: white; color: black">UpdateAccelerometerValues(</span><span style="background: white; color: blue">double </span><span style="background: white; color: black">x, </span><span style="background: white; color: blue">double </span><span style="background: white; color: black">y, </span><span style="background: white; color: blue">double </span><span style="background: white; color: black">z)
        {
            </span><span style="background: white; color: blue">if</span><span style="background: white; color: black">(_bFirstUpdate)
            {
                _lastX = x;
                _lastY = y;
                _lastZ = z;
                _bFirstUpdate = </span><span style="background: white; color: blue">false</span><span style="background: white; color: black">;
            }
            </span><span style="background: white; color: blue">else
            </span><span style="background: white; color: black">{
                _lastX = _currentX;
                _lastY = _currentY;
                _lastZ = _currentZ;
            }

            _currentX = x;
            _currentY = y;
            _currentZ = z;

        }

        </span><span style="background: white; color: blue">private bool </span><span style="background: white; color: black">CheckAccelerationChanged()
        {
            </span><span style="background: white; color: blue">double </span><span style="background: white; color: black">xChange = </span><span style="background: white; color: #2b91af">Math</span><span style="background: white; color: black">.Abs(_lastX - _currentX);
            </span><span style="background: white; color: blue">double </span><span style="background: white; color: black">yChange = </span><span style="background: white; color: #2b91af">Math</span><span style="background: white; color: black">.Abs(_lastY - _currentY);
            </span><span style="background: white; color: blue">double </span><span style="background: white; color: black">zChange = </span><span style="background: white; color: #2b91af">Math</span><span style="background: white; color: black">.Abs(_lastZ - _currentZ);

            </span><span style="background: white; color: green">// Debug.WriteLine(&quot;Accel: {0}&quot;, xChange+yChange+zChange);

            </span><span style="background: white; color: blue">if </span><span style="background: white; color: black">(xChange + yChange + zChange &gt; Threshold)
                </span><span style="background: white; color: blue">return true</span><span style="background: white; color: black">;
            
            </span><span style="background: white; color: blue">return false</span><span style="background: white; color: black">;

        }

        </span><span style="background: white; color: blue">private void </span><span style="background: white; color: black">IntervalTimer_Task(</span><span style="background: white; color: blue">object </span><span style="background: white; color: black">state)
        {
            </span><span style="background: white; color: #2b91af">AccelerometerReading </span><span style="background: white; color: black">current = </span><span style="background: white; color: #2b91af">Accelerometer</span><span style="background: white; color: black">.GetDefault().GetCurrentReading();         
            </span><span style="background: white; color: #2b91af">DateTimeOffset </span><span style="background: white; color: black">now = current.Timestamp;

            UpdateAccelerometerValues(current.AccelerationX, current.AccelerationY, current.AccelerationZ);

            </span><span style="background: white; color: green">//   Check and raise Shake
            </span><span style="background: white; color: blue">if </span><span style="background: white; color: black">((!_bShake) &amp;&amp; CheckAccelerationChanged())
            {                                     
                _bShake = </span><span style="background: white; color: blue">true</span><span style="background: white; color: black">;
            }
            </span><span style="background: white; color: blue">else if </span><span style="background: white; color: black">((_bShake) &amp;&amp; CheckAccelerationChanged())
            {
                _bFirstUpdate = </span><span style="background: white; color: blue">true</span><span style="background: white; color: black">;  </span><span style="background: white; color: green">//  Reset Detection
                </span><span style="background: white; color: black">OnShaken(</span><span style="background: white; color: blue">new </span><span style="background: white; color: #2b91af">EventArgs</span><span style="background: white; color: black">());
            }
            </span><span style="background: white; color: blue">else if </span><span style="background: white; color: black">((_bShake) &amp;&amp; (!CheckAccelerationChanged()))
            {                           
                _bShake = </span><span style="background: white; color: blue">false</span><span style="background: white; color: black">;
            }

        }

    }
}
</span></pre>

<p>The following code is a simple XAML Page that starts/stops the ShakeDetector, and logs the Date/Time of the event to the UI.</p>

<p><strong><a href="javascript:CopyCode('xamlsection1');">Copy Code:</a></strong> </p>

<pre id="xamlsection1" class="code"><span style="background: white; color: blue">&lt;</span><span style="background: white; color: #a31515">Page
    </span><span style="background: white; color: red">x</span><span style="background: white; color: blue">:</span><span style="background: white; color: red">Class</span><span style="background: white; color: blue">=&quot;PhoneShake.MainPage&quot;
    </span><span style="background: white; color: red">xmlns</span><span style="background: white; color: blue">=&quot;https://schemas.microsoft.com/winfx/2006/xaml/presentation&quot;
    </span><span style="background: white; color: red">xmlns</span><span style="background: white; color: blue">:</span><span style="background: white; color: red">x</span><span style="background: white; color: blue">=&quot;https://schemas.microsoft.com/winfx/2006/xaml&quot;
    </span><span style="background: white; color: red">xmlns</span><span style="background: white; color: blue">:</span><span style="background: white; color: red">local</span><span style="background: white; color: blue">=&quot;using:PhoneShake&quot;
    </span><span style="background: white; color: red">xmlns</span><span style="background: white; color: blue">:</span><span style="background: white; color: red">d</span><span style="background: white; color: blue">=&quot;https://schemas.microsoft.com/expression/blend/2008&quot;
    </span><span style="background: white; color: red">xmlns</span><span style="background: white; color: blue">:</span><span style="background: white; color: red">mc</span><span style="background: white; color: blue">=&quot;https://schemas.openxmlformats.org/markup-compatibility/2006&quot;
    </span><span style="background: white; color: red">mc</span><span style="background: white; color: blue">:</span><span style="background: white; color: red">Ignorable</span><span style="background: white; color: blue">=&quot;d&quot;
    </span><span style="background: white; color: red">Background</span><span style="background: white; color: blue">=&quot;{</span><span style="background: white; color: #a31515">ThemeResource </span><span style="background: white; color: red">ApplicationPageBackgroundThemeBrush</span><span style="background: white; color: blue">}&quot;&gt;

    &lt;</span><span style="background: white; color: #a31515">StackPanel</span><span style="background: white; color: blue">&gt;
        &lt;</span><span style="background: white; color: #a31515">Button </span><span style="background: white; color: red">x</span><span style="background: white; color: blue">:</span><span style="background: white; color: red">Name</span><span style="background: white; color: blue">=&quot;btnStart&quot; </span><span style="background: white; color: red">Content</span><span style="background: white; color: blue">=&quot;Start&quot; </span><span style="background: white; color: red">Click</span><span style="background: white; color: blue">=&quot;btnStart_Click&quot;/&gt;
        &lt;</span><span style="background: white; color: #a31515">Button </span><span style="background: white; color: red">x</span><span style="background: white; color: blue">:</span><span style="background: white; color: red">Name</span><span style="background: white; color: blue">=&quot;btnStop&quot; </span><span style="background: white; color: red">Content</span><span style="background: white; color: blue">=&quot;Stop&quot; </span><span style="background: white; color: red">Click</span><span style="background: white; color: blue">=&quot;btnStop_Click&quot;/&gt;
        &lt;</span><span style="background: white; color: #a31515">TextBlock </span><span style="background: white; color: red">x</span><span style="background: white; color: blue">:</span><span style="background: white; color: red">Name</span><span style="background: white; color: blue">=&quot;txtEvent&quot; /&gt;
    &lt;/</span><span style="background: white; color: #a31515">StackPanel</span><span style="background: white; color: blue">&gt;
&lt;/</span><span style="background: white; color: #a31515">Page</span><span style="background: white; color: blue">&gt;
</span></pre>

<p><strong><a href="javascript:CopyCode('codesection2');">Copy Code:</a></strong></p>

<pre id="codesection2" class="code"><span style="background: white; color: blue">using </span><span style="background: white; color: black">System;
</span><span style="background: white; color: blue">using </span><span style="background: white; color: black">System.Collections.Generic;
</span><span style="background: white; color: blue">using </span><span style="background: white; color: black">System.Diagnostics;
</span><span style="background: white; color: blue">using </span><span style="background: white; color: black">System.IO;
</span><span style="background: white; color: blue">using </span><span style="background: white; color: black">System.Linq;
</span><span style="background: white; color: blue">using </span><span style="background: white; color: black">System.Runtime.InteropServices.WindowsRuntime;
</span><span style="background: white; color: blue">using </span><span style="background: white; color: black">Windows.Foundation;
</span><span style="background: white; color: blue">using </span><span style="background: white; color: black">Windows.Foundation.Collections;
</span><span style="background: white; color: blue">using </span><span style="background: white; color: black">Windows.UI.Core;
</span><span style="background: white; color: blue">using </span><span style="background: white; color: black">Windows.UI.Xaml;
</span><span style="background: white; color: blue">using </span><span style="background: white; color: black">Windows.UI.Xaml.Controls;
</span><span style="background: white; color: blue">using </span><span style="background: white; color: black">Windows.UI.Xaml.Controls.Primitives;
</span><span style="background: white; color: blue">using </span><span style="background: white; color: black">Windows.UI.Xaml.Data;
</span><span style="background: white; color: blue">using </span><span style="background: white; color: black">Windows.UI.Xaml.Input;
</span><span style="background: white; color: blue">using </span><span style="background: white; color: black">Windows.UI.Xaml.Media;
</span><span style="background: white; color: blue">using </span><span style="background: white; color: black">Windows.UI.Xaml.Navigation;

</span><span style="background: white; color: green">// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=391641

</span><span style="background: white; color: blue">namespace </span><span style="background: white; color: black">PhoneShake
{
    </span><span style="background: white; color: gray">/// &lt;summary&gt;
    /// </span><span style="background: white; color: green">An empty page that can be used on its own or navigated to within a Frame.
    </span><span style="background: white; color: gray">/// &lt;/summary&gt;
    </span><span style="background: white; color: blue">public sealed partial class </span><span style="background: white; color: #2b91af">MainPage </span><span style="background: white; color: black">: </span><span style="background: white; color: #2b91af">Page
    </span><span style="background: white; color: black">{
        </span><span style="background: white; color: blue">public </span><span style="background: white; color: black">MainPage()
        {
            </span><span style="background: white; color: blue">this</span><span style="background: white; color: black">.InitializeComponent();

            </span><span style="background: white; color: blue">this</span><span style="background: white; color: black">.NavigationCacheMode = </span><span style="background: white; color: #2b91af">NavigationCacheMode</span><span style="background: white; color: black">.Required;
            btnStop.IsEnabled = </span><span style="background: white; color: blue">false</span><span style="background: white; color: black">;
        }

        </span><span style="background: white; color: gray">/// &lt;summary&gt;
        /// </span><span style="background: white; color: green">Invoked when this page is about to be displayed in a Frame.
        </span><span style="background: white; color: gray">/// &lt;/summary&gt;
        /// &lt;param name=&quot;e&quot;&gt;</span><span style="background: white; color: green">Event data that describes how this page was reached.
        </span><span style="background: white; color: gray">/// </span><span style="background: white; color: green">This parameter is typically used to configure the page.</span><span style="background: white; color: gray">&lt;/param&gt;
        </span><span style="background: white; color: blue">protected override void </span><span style="background: white; color: black">OnNavigatedTo(</span><span style="background: white; color: #2b91af">NavigationEventArgs </span><span style="background: white; color: black">e)
        {
            </span><span style="background: white; color: green">// TODO: Prepare page for display here.

            // TODO: If your application contains multiple pages, ensure that you are
            // handling the hardware Back button by registering for the
            // Windows.Phone.UI.Input.HardwareButtons.BackPressed event.
            // If you are using the NavigationHelper provided by some templates,
            // this event is handled for you.
        </span><span style="background: white; color: black">}

        </span><span style="background: white; color: blue">private void </span><span style="background: white; color: black">btnStart_Click(</span><span style="background: white; color: blue">object </span><span style="background: white; color: black">sender, </span><span style="background: white; color: #2b91af">RoutedEventArgs </span><span style="background: white; color: black">e)
        {
            </span><span style="background: white; color: #2b91af">ShakeDetector</span><span style="background: white; color: black">.Instance.Start();
            </span><span style="background: white; color: #2b91af">ShakeDetector</span><span style="background: white; color: black">.Instance.Shaken += Instance_Shaken;
            btnStop.IsEnabled = </span><span style="background: white; color: blue">true</span><span style="background: white; color: black">;
            btnStart.IsEnabled = </span><span style="background: white; color: blue">false</span><span style="background: white; color: black">;
        }

        </span><span style="background: white; color: blue">void </span><span style="background: white; color: black">Instance_Shaken(</span><span style="background: white; color: blue">object </span><span style="background: white; color: black">sender, </span><span style="background: white; color: #2b91af">EventArgs </span><span style="background: white; color: black">e)
        {
            </span><span style="background: white; color: #2b91af">Debug</span><span style="background: white; color: black">.WriteLine(</span><span style="background: white; color: #a31515">&quot;Device Shook&quot;</span><span style="background: white; color: black">);
            Dispatcher.RunAsync(</span><span style="background: white; color: #2b91af">CoreDispatcherPriority</span><span style="background: white; color: black">.Normal, () =&gt;
            {
                txtEvent.Text = </span><span style="background: white; color: blue">string</span><span style="background: white; color: black">.Format(</span><span style="background: white; color: #a31515">&quot;Shake Detected at {0}&quot;</span><span style="background: white; color: black">, </span><span style="background: white; color: #2b91af">DateTime</span><span style="background: white; color: black">.UtcNow);
            });
            
        }

        </span><span style="background: white; color: blue">private void </span><span style="background: white; color: black">btnStop_Click(</span><span style="background: white; color: blue">object </span><span style="background: white; color: black">sender, </span><span style="background: white; color: #2b91af">RoutedEventArgs </span><span style="background: white; color: black">e)
        {
            </span><span style="background: white; color: #2b91af">ShakeDetector</span><span style="background: white; color: black">.Instance.Stop();
            </span><span style="background: white; color: #2b91af">ShakeDetector</span><span style="background: white; color: black">.Instance.Shaken -= Instance_Shaken;
            btnStop.IsEnabled = </span><span style="background: white; color: blue">false</span><span style="background: white; color: black">;
            btnStart.IsEnabled = </span><span style="background: white; color: blue">true</span><span style="background: white; color: black">;
        }
    }
}
</span></pre>

<p>I hope this article helps those developers writing for Windows Phone 8.1 to use the Shake gesture for something fun.&#160; Until next time have fun coding!</p>

<p>Don’t forget to follow the Windows Store Developer Solutions team on Twitter <a href="https://twitter.com/wsdevsol">@wsdevsol</a>. Comments are welcome, both below and on twitter.</p>

<p>- Bret Bentzinger(Microsoft) <a href="https://twitter.com/awehellyeah">@awehellyeah</a></p>]]></content:encoded>
    </item>
    <item>
      <title>Replacement for MarketplaceReviewTask in Windows Phone 8.1</title>
      <link>https://docs.microsoft.com/archive/blogs/wsdevsol/replacement-for-marketplacereviewtask-in-windows-phone-8-1</link>
      <pubDate>Thu, 11 Jun 2015 12:01:00 GMT</pubDate>
      <dc:creator><![CDATA[Jeff Sanders]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/wsdevsol/2015/06/11/replacement-for-marketplacereviewtask-in-windows-phone-8-1/</guid>
      <description><![CDATA[Windows Phone Silverlight apps had a MarketplaceReviewTask to prompt users to review an app. Windows...]]></description>
      <content:encoded><![CDATA[<p>Windows Phone Silverlight apps had a MarketplaceReviewTask to prompt users to review an app. Windows Phone Runtime apps don't have an explicit task for this but can launch ms-windows-store: URIs to go to the review page.</p>
<p>Use this with care and thought<span style="background: white; color: black;">! </span></p>
<p><span style="background: white; color: black;">Happy users give good reviews. Irritated users give bad ones. An occasional prompt after the user has successfully completed a task will likely get better reviews than frequent prompts&nbsp;which get in the way of getting things done (I admit it: I've filed bad reviews just to make the darn things go away).</span></p>
<p><span style="background: white; color: black;">Consider prompting after the user beats a friend's high score, completes a lesson with a good grade, or meets a fitness goal.</span></p>
<p><span style="background: white; color: black;">Avoid prompting when the user does poorly on a game, or initially launches the app: the user opened the app to use it and may be irritated to get pushed off elsewhere.</span></p>
<p>&nbsp;</p>
<p><span style="background: white; color: black;">There isn't a good way to tell if the user actually filed the review. I'd stop asking after sending the user to the review page once.</span></p>
<p><span style="background: white; color: black;">&nbsp;&nbsp;&nbsp; </span><span style="background: white; color: blue;">await </span><span style="background: white; color: black;">Windows.System.</span><span style="background: white; color: #2b91af;">Launcher</span><span style="background: white; color: black;">.LaunchUriAsync(</span><span style="background: white; color: blue;">new </span><span style="background: white; color: #2b91af;">Uri</span><span style="background: white; color: black;">(</span><span style="background: white; color: #a31515;">"ms-windows-store:reviewapp</span><span style="background: white; color: black;">));</span></p>
<p>For Windows 8.1 (see <a title="Linking to your app" href="https://msdn.microsoft.com/en-us/library/windows/apps/hh974767.aspx">Linking to your app</a>&nbsp;in the <a id="mt170633_WIN.10_en-us" title="Promote Windows Store apps" href="https://msdn.microsoft.com/en-us/library/windows/apps/dn745655.aspx" data-tochassubtree="true">Promote Windows Store apps</a> docs&nbsp;&nbsp;)</p>
<p><span style="background: white; color: blue;">&nbsp;&nbsp;&nbsp; await </span><span style="background: white; color: black;">Windows.System.</span><span style="background: white; color: #2b91af;">Launcher</span><span style="background: white; color: black;">.LaunchUriAsync(</span><span style="background: white; color: blue;">new </span><span style="background: white; color: #2b91af;">Uri</span><span style="background: white; color: black;">(</span><span style="background: white; color: #a31515;">"ms-windows-store:review?PFN=" </span><span style="background: white; color: black;">+ </span><span style="background: white; color: #2b91af;">packageFamilyName</span><span style="background: white; color: black;">));</span></p>
<p>&nbsp;</p>
<p><span style="background: white; color: black;">We'll update this entry with Windows 10 information when the unified Windows Dev Center is fully up and running.</span></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>]]></content:encoded>
    </item>
    <item>
      <title>I want the sound to go *here* – Audio routing in Windows Phone 8.1</title>
      <link>https://docs.microsoft.com/archive/blogs/wsdevsol/i-want-the-sound-to-go-here-audio-routing-in-windows-phone-8-1</link>
      <pubDate>Fri, 29 May 2015 07:15:00 GMT</pubDate>
      <dc:creator><![CDATA[James Dailey - MSFT]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/wsdevsol/2015/05/29/i-want-the-sound-to-go-here-audio-routing-in-windows-phone-8-1/</guid>
      <description><![CDATA[Windows Phone 8.1 devices have a number of different audio output options. Most of the time the...]]></description>
      <content:encoded><![CDATA[<p>Windows Phone 8.1 devices have a number of different audio output options. Most of the time the audio is routed to the default or &ldquo;active&rdquo; endpoint. The default endpoint is determined by a number of factors. If your phone is connected to a Bluetooth device that supports audio then it will be routed there by default. A common example is the Bluetooth enabled car. When you start your car it talks with your phone and automatically routes the audio to the vehicle speakers.</p>
<p>Sometimes though, you want your app to be able to control where the audio is getting routed. That is where the <a href="https://msdn.microsoft.com/en-us/library/windows.phone.media.devices.audioroutingmanager.aspx">AudioRoutingManager</a> comes in handy. The AudioRoutingManager allows you to specify one of the supported audio endpoints. There are usually four possible endpoints but not all of them may be available. They are: None, earpiece,&nbsp; speakerphone and Bluetooth. For more detail on how these are related check out Matthew van Eerde&rsquo;s <a href="https://blogs.msdn.com/b/matthew_van_eerde/archive/2014/03/17/a-mental-model-for-the-windows-phone-audioroutingmanager-api.aspx">blog</a> on the subject.</p>
<p>There are two keys to successfully using the AudioRoutingManger.</p>
<p><strong>Key #1) You need to add the ID_CAP_VOIP capability to your app.</strong></p>
<p>You can do this using the manifest editor for Windows Phone Silverlight apps but it&rsquo;s not quite as easy to do this for Windows Phone 8.1 Runtime apps.</p>
<p>Here&rsquo;s what you need to do for your Windows Phone 8.1 Runtime app:</p>
<ol><ol>
<li>Create a new XML file and name it WindowsPhoneReservedAppInfo.xml</li>
<li>Add the new file to the root of your Windows Phone 8.1 Runtime project in Visual Studio <br /> <br /><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/85/metablogapi/0572.Capture_200CFC66.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-85-metablogapi/0572.Capture_5F00_200CFC66.png"><img style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border: 0px;" title="Capture" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/85/metablogapi/3034.Capture_thumb_7FF1EFA8.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-85-metablogapi/3034.Capture_5F00_thumb_5F00_7FF1EFA8.png" alt="Capture" width="219" height="244" border="0" /></a></li>
<li>Add the following XML to the file:</li>
</ol></ol>
<div id="codeSnippetWrapper" style="overflow: auto; cursor: text; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 97.5%; direction: ltr; text-align: left; margin: 20px 0px 10px; line-height: 12pt; max-height: 200px; background-color: #f4f4f4; border: silver 1px solid; padding: 4px;">
<div id="codeSnippet" style="overflow: visible; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; color: black; direction: ltr; text-align: left; line-height: 12pt; background-color: #f4f4f4; border-style: none; padding: 0px;">
<pre style="overflow: visible; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; color: black; direction: ltr; text-align: left; margin: 0em; line-height: 12pt; background-color: white; border-style: none; padding: 0px;"><span id="lnum1" style="color: #606060;"> 1:</span> <span style="color: #0000ff;">&lt;?</span><span style="color: #800000;">xml</span> <span style="color: #ff0000;">version</span><span style="color: #0000ff;">="1.0"</span> <span style="color: #ff0000;">encoding</span><span style="color: #0000ff;">="utf-8"</span>?<span style="color: #0000ff;">&gt;</span></pre>
<!--CRLF-->
<pre style="overflow: visible; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; color: black; direction: ltr; text-align: left; margin: 0em; line-height: 12pt; background-color: #f4f4f4; border-style: none; padding: 0px;"><span id="lnum2" style="color: #606060;"> 2:</span> <span style="color: #0000ff;">&lt;</span><span style="color: #800000;">WindowsPhoneReservedAppInfo</span> <span style="color: #ff0000;">xmlns</span><span style="color: #0000ff;">="https://schemas.microsoft.com/phone/2013/windowsphonereservedappinfo"</span><span style="color: #0000ff;">&gt;</span></pre>
<!--CRLF-->
<pre style="overflow: visible; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; color: black; direction: ltr; text-align: left; margin: 0em; line-height: 12pt; background-color: white; border-style: none; padding: 0px;"><span id="lnum3" style="color: #606060;"> 3:</span>   <span style="color: #0000ff;">&lt;</span><span style="color: #800000;">SoftwareCapabilities</span><span style="color: #0000ff;">&gt;</span></pre>
<!--CRLF-->
<pre style="overflow: visible; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; color: black; direction: ltr; text-align: left; margin: 0em; line-height: 12pt; background-color: #f4f4f4; border-style: none; padding: 0px;"><span id="lnum4" style="color: #606060;"> 4:</span>     <span style="color: #0000ff;">&lt;</span><span style="color: #800000;">SoftwareCapability</span> <span style="color: #ff0000;">Id</span><span style="color: #0000ff;">="ID_CAP_VOIP"</span> <span style="color: #0000ff;">/&gt;</span></pre>
<!--CRLF-->
<pre style="overflow: visible; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; color: black; direction: ltr; text-align: left; margin: 0em; line-height: 12pt; background-color: white; border-style: none; padding: 0px;"><span id="lnum5" style="color: #606060;"> 5:</span>   <span style="color: #0000ff;">&lt;/</span><span style="color: #800000;">SoftwareCapabilities</span><span style="color: #0000ff;">&gt;</span></pre>
<!--CRLF-->
<pre style="overflow: visible; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; color: black; direction: ltr; text-align: left; margin: 0em; line-height: 12pt; background-color: #f4f4f4; border-style: none; padding: 0px;"><span id="lnum6" style="color: #606060;"> 6:</span> <span style="color: #0000ff;">&lt;/</span><span style="color: #800000;">WindowsPhoneReservedAppInfo</span><span style="color: #0000ff;">&gt;</span></pre>
<!--CRLF--></div>
</div>
<p><strong>Key #2) You need to make sure the audio is streaming before you change the endpoint.</strong></p>
<p>This means that if you re using an audio technology like WASAPI you need to call:</p>
<p><a href="https://msdn.microsoft.com/en-us/library/windows/desktop/dd370879(v=vs.85).aspx">IAudioClient::Start</a></p>
<p>Before you call:</p>
<p><a href="https://msdn.microsoft.com/en-us/library/windows.phone.media.devices.audioroutingmanager.setaudioendpoint.aspx">AudioRoutingManager.SetAudioEndpoint</a></p>
<p>If the stream is not started and you call SetAudioEndpoint you will get an error and the endpoint won&rsquo;t change. Of course this does have the potential for the audio to come out of the wrong endpoint a few milliseconds before the endpoint gets switched. Unfortunately there is no way around this other than to roll silence before switching the endpoint.</p>
<p>Other things to consider:</p>
<ul>
<li>When you specify the ID_CAP_VOIP in your app the default endpoint may change. For most audio apps the external speaker will be the default unless Bluetooth is available. When you have ID_CAP_VOIP set then the earphone becomes the default endpoint unless bluethooth is available.</li>
<li>The AudioRoutingManager.SetAudioEndpoint API doesn&rsquo;t work in the emulator. Basically it is a &ldquo;no-op&rdquo; but luckily it doesn&rsquo;t appear to cause an error.</li>
<li>If you are getting the following exception: HRESULT: 0x80070005 (E_ACCESSDENIED) when calling SetAudioEndpoint&nbsp; you don&rsquo;t have your WindowsPhoneReservedAppInfo.xml file setup correctly or the file is not getting parsed properly at runtime. Make sure the file is flagged as &ldquo;Content&rdquo; with an item type of XML. <br /> <br /><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/85/metablogapi/3443.Capture2_31E99033.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-85-metablogapi/3443.Capture2_5F00_31E99033.png"><img style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border: 0px;" title="Capture2" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/85/metablogapi/8233.Capture2_thumb_4AE56078.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-85-metablogapi/8233.Capture2_5F00_thumb_5F00_4AE56078.png" alt="Capture2" width="229" height="93" border="0" /></a></li>
</ul>
<p>I hope this helps,</p>
<p>James</p>
<p>&nbsp;</p>
<p><span class="TextRun SCX85070397" style="color: windowtext; line-height: 17px; font-family: Calibri,Sans-Serif; font-size: 11pt;" xml:lang="EN-US"><span class="NormalTextRun SCX85070397" style="background-color: inherit;">Follow the Windows Store Developer Solutions team on Twitter </span></span><a class="Hyperlink SCX85070397" href="https://twitter.com/wsdevsol"><span class="TextRun SCX85070397" style="line-height: 17px; font-family: Calibri,Sans-Serif; font-size: 11pt;" xml:lang="EN-US"><span class="NormalTextRun SCX85070397" style="background-color: inherit;">@wsdevsol</span></span></a><span class="TextRun SCX85070397" style="color: windowtext; line-height: 17px; font-family: Calibri,Sans-Serif; font-size: 11pt;" xml:lang="EN-US"><span class="NormalTextRun SCX85070397" style="background-color: inherit;">. Comments are welcome, both below and on twitter.</span></span></p>
<p>&nbsp;</p>]]></content:encoded>
    </item>
    <item>
      <title>Configuring your HttpClient to automagically decompress the response</title>
      <link>https://docs.microsoft.com/archive/blogs/wsdevsol/configuring-your-httpclient-to-automagically-decompress-the-response</link>
      <pubDate>Thu, 21 May 2015 08:46:00 GMT</pubDate>
      <dc:creator><![CDATA[Bret Bentzinger]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/wsdevsol/2015/05/21/configuring-your-httpclient-to-automagically-decompress-the-response/</guid>
      <description><![CDATA[// 
&nbsp;
Recently I was writing a simple HttpClient to interface with a REST API.&nbsp;...]]></description>
      <content:encoded><![CDATA[<script type="text/javascript" language="jscript">// <![CDATA[
    function CopyCode(elemName) {
        var obj = document.getElementById(elemName);
        window.clipboardData.setData("Text", obj.innerText);
    }
// ]]]]><![CDATA[></script>
<p>&nbsp;</p>
<p>Recently I was writing a simple HttpClient to interface with a REST API.&nbsp; Typically I just pass the response string to a JSON converter and get my object out the other end.&nbsp; However, in my case I was getting the following error from my converter:</p>
<blockquote>
<p><span style="color: #ff0000;"><span style="color: #c0504d;">Newtonsoft.Json.JsonReaderException was caught <br />&nbsp; _HResult=-2146233088 <br />&nbsp; _message=Unexpected character encountered while parsing value:&nbsp; . Path '', line 0, position 0. <br />&nbsp; HResult=-2146233088 <br />&nbsp; IsTransient=false <br />&nbsp; Message=Unexpected character encountered while parsing value:&nbsp; . Path '', line 0, position 0. <br />&nbsp; Source=Newtonsoft.Json <br />&nbsp; LineNumber=0 <br />&nbsp; LinePosition=0 <br />&nbsp; Path="" <br />&nbsp; StackTrace: <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at Newtonsoft.Json.JsonTextReader.ParseValue() <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at Newtonsoft.Json.JsonTextReader.ReadInternal() <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at Newtonsoft.Json.JsonTextReader.Read() <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.ReadForType(JsonReader reader, JsonContract contract, Boolean hasConverter) <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent) <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType) <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at Newtonsoft.Json.JsonSerializer.Deserialize(JsonReader reader, Type objectType) <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings) <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings) <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value) <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at WSDSForumAPI.StackOverflow.&lt;GetPostsForTag&gt;d__0.MoveNext()&nbsp; <br />&nbsp; InnerException:</span> </span></p>
</blockquote>
<p>When I looked into the issue the string being passed to the converter looked like this: <br /> <br /><strong>"�\b\0\0\0\0\0\0��ko�6��\n��ɌD&hellip;.."</strong></p>
<p>I attached fiddler, and then realized that my response content was compressed, as the response had the following header:</p>
<p><strong>Content-Encoding: gzip</strong> </p>
<p>So I set out to figure out how to decompress the content.&nbsp;&nbsp; It turns out this is fairly simple.&nbsp;&nbsp; Just create a HttpClientHandler and set its AutomaticDecompression to the type of compression used in the response.&nbsp; The following code snippet is what I ended up with for my scenario:</p>
<p><strong><a href="javascript:CopyCode('CopyCodeCodeSection1');">Copy Code:</a></strong></p>
<pre id="CopyCodeCodeSection1" class="code"><span style="background: white; color: #2b91af;">HttpClientHandler </span><span style="background: white; color: black;">handler = </span><span style="background: white; color: blue;">new </span><span style="background: white; color: #2b91af;">HttpClientHandler</span><span style="background: white; color: black;">(); handler.AutomaticDecompression = System.Net.</span><span style="background: white; color: #2b91af;">DecompressionMethods</span><span style="background: white; color: black;">.GZip; _client = </span><span style="background: white; color: blue;">new </span><span style="background: white; color: #2b91af;">HttpClient</span><span style="background: white; color: black;">(handler);</span></pre>
<p>That is it for this blog post.&nbsp; Simple and to the point.&nbsp; Until next time have fun coding!</p>
<p>Don&rsquo;t forget to follow the Windows Store Developer Solutions team on Twitter <a href="https://twitter.com/wsdevsol">@wsdevsol</a>. Comments are welcome, both below and on twitter.</p>
<p>- Bret Bentzinger(Microsoft) <a href="https://twitter.com/awehellyeah">@awehellyeah</a></p>]]></content:encoded>
    </item>
    <item>
      <title>MDM Enrollment succeeds but SyncML session aborts without errors</title>
      <link>https://docs.microsoft.com/archive/blogs/wsdevsol/mdm-enrollment-succeeds-but-syncml-session-aborts-without-errors</link>
      <pubDate>Thu, 14 May 2015 01:00:00 GMT</pubDate>
      <dc:creator><![CDATA[Prashant H Phadke]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/wsdevsol/2015/05/14/mdm-enrollment-succeeds-but-syncml-session-aborts-without-errors/</guid>
      <description><![CDATA[When helping customers implement MDM solutions for Windows 8.1, we frequently encounter scenarios...]]></description>
      <content:encoded><![CDATA[<p>When helping customers implement MDM solutions for Windows 8.1, we frequently encounter scenarios where the initial Enrollment with the MDM server succeeds, but right after enrollment, the SyncML session between the client and the MDM server seems to just &ldquo;abort&rdquo; without any errors and you are left with a daunting task of understanding what did your MDM server do wrong!</p>
<p>This blog discusses the basic problem most customers report.</p>
<p>OK, so here we go&hellip;.</p>
<p>After the device has been setup with the initial HTTP request/response message exchange, the SyncML session starts with a HTTP request to the server which includes the basic device information.</p>
<p>In response to the server&rsquo;s message, if <strong>the server expects</strong> that the client should continue further communication (such as the response of a command status), <strong>the server MUST ensure that the HTTP response &ndash; SyncML XML content is sent as a single line without extra line breaks or spaces in between the XML document.</strong></p>
<p>If your server response contains new lines and/or extra spaces between the XML tags, we have noticed that the MDM Agent will just stop without issuing any further HTTP requests. At that point, the server does not quite know why there was no further communication from the client.</p>
<p>For example if your server was to send the following SyncML (I have taken out the actual sections and kept it short for brevity):</p>
<div id="codeSnippetWrapper" style="font-size: 8pt; overflow: auto; cursor: text; font-family: 'Courier New', courier, monospace; width: 97.5%; direction: ltr; text-align: left; margin: 20px 0px 10px; line-height: 12pt; max-height: 200px; background-color: #f4f4f4; border: silver 1px solid; padding: 4px;">
<div id="codeSnippet" style="font-size: 8pt; overflow: visible; font-family: 'Courier New', courier, monospace; width: 100%; color: black; direction: ltr; text-align: left; line-height: 12pt; background-color: #f4f4f4; border-style: none; padding: 0px;">
<pre style="font-size: 8pt; overflow: visible; font-family: 'Courier New', courier, monospace; width: 100%; color: black; direction: ltr; text-align: left; margin: 0em; line-height: 12pt; background-color: white; border-style: none; padding: 0px;">&lt;SyncML xmlns=<span style="color: #006080;">"SYNCML:SYNCML1.2"</span>&gt; </pre>
<!--CRLF-->
<pre style="font-size: 8pt; overflow: visible; font-family: 'Courier New', courier, monospace; width: 100%; color: black; direction: ltr; text-align: left; margin: 0em; line-height: 12pt; background-color: #f4f4f4; border-style: none; padding: 0px;">  &lt;SyncHdr&gt; </pre>
<!--CRLF-->
<pre style="font-size: 8pt; overflow: visible; font-family: 'Courier New', courier, monospace; width: 100%; color: black; direction: ltr; text-align: left; margin: 0em; line-height: 12pt; background-color: white; border-style: none; padding: 0px;">    &lt;VerDTD&gt;1.2&lt;/VerDTD&gt; </pre>
<!--CRLF-->
<pre style="font-size: 8pt; overflow: visible; font-family: 'Courier New', courier, monospace; width: 100%; color: black; direction: ltr; text-align: left; margin: 0em; line-height: 12pt; background-color: #f4f4f4; border-style: none; padding: 0px;">    &lt;VerProto&gt;DM/1.2&lt;/VerProto&gt; </pre>
<!--CRLF-->
<pre style="font-size: 8pt; overflow: visible; font-family: 'Courier New', courier, monospace; width: 100%; color: black; direction: ltr; text-align: left; margin: 0em; line-height: 12pt; background-color: white; border-style: none; padding: 0px;">    ...other elements... </pre>
<!--CRLF-->
<pre style="font-size: 8pt; overflow: visible; font-family: 'Courier New', courier, monospace; width: 100%; color: black; direction: ltr; text-align: left; margin: 0em; line-height: 12pt; background-color: #f4f4f4; border-style: none; padding: 0px;">  &lt;/SyncHdr&gt; </pre>
<!--CRLF-->
<pre style="font-size: 8pt; overflow: visible; font-family: 'Courier New', courier, monospace; width: 100%; color: black; direction: ltr; text-align: left; margin: 0em; line-height: 12pt; background-color: white; border-style: none; padding: 0px;">  &lt;SyncBody&gt; </pre>
<!--CRLF-->
<pre style="font-size: 8pt; overflow: visible; font-family: 'Courier New', courier, monospace; width: 100%; color: black; direction: ltr; text-align: left; margin: 0em; line-height: 12pt; background-color: #f4f4f4; border-style: none; padding: 0px;">    &lt;Status&gt; </pre>
<!--CRLF-->
<pre style="font-size: 8pt; overflow: visible; font-family: 'Courier New', courier, monospace; width: 100%; color: black; direction: ltr; text-align: left; margin: 0em; line-height: 12pt; background-color: white; border-style: none; padding: 0px;">      ...other elements...</pre>
<!--CRLF-->
<pre style="font-size: 8pt; overflow: visible; font-family: 'Courier New', courier, monospace; width: 100%; color: black; direction: ltr; text-align: left; margin: 0em; line-height: 12pt; background-color: #f4f4f4; border-style: none; padding: 0px;">    &lt;/Status&gt;</pre>
<!--CRLF-->
<pre style="font-size: 8pt; overflow: visible; font-family: 'Courier New', courier, monospace; width: 100%; color: black; direction: ltr; text-align: left; margin: 0em; line-height: 12pt; background-color: white; border-style: none; padding: 0px;">    &lt;Replace&gt;</pre>
<!--CRLF-->
<pre style="font-size: 8pt; overflow: visible; font-family: 'Courier New', courier, monospace; width: 100%; color: black; direction: ltr; text-align: left; margin: 0em; line-height: 12pt; background-color: #f4f4f4; border-style: none; padding: 0px;">      ...other elements...</pre>
<!--CRLF-->
<pre style="font-size: 8pt; overflow: visible; font-family: 'Courier New', courier, monospace; width: 100%; color: black; direction: ltr; text-align: left; margin: 0em; line-height: 12pt; background-color: white; border-style: none; padding: 0px;">    &lt;/Replace&gt;</pre>
<!--CRLF-->
<pre style="font-size: 8pt; overflow: visible; font-family: 'Courier New', courier, monospace; width: 100%; color: black; direction: ltr; text-align: left; margin: 0em; line-height: 12pt; background-color: #f4f4f4; border-style: none; padding: 0px;">    &lt;Get&gt;</pre>
<!--CRLF-->
<pre style="font-size: 8pt; overflow: visible; font-family: 'Courier New', courier, monospace; width: 100%; color: black; direction: ltr; text-align: left; margin: 0em; line-height: 12pt; background-color: white; border-style: none; padding: 0px;">      ...other elements...</pre>
<!--CRLF-->
<pre style="font-size: 8pt; overflow: visible; font-family: 'Courier New', courier, monospace; width: 100%; color: black; direction: ltr; text-align: left; margin: 0em; line-height: 12pt; background-color: #f4f4f4; border-style: none; padding: 0px;">    &lt;/Get&gt;</pre>
<!--CRLF-->
<pre style="font-size: 8pt; overflow: visible; font-family: 'Courier New', courier, monospace; width: 100%; color: black; direction: ltr; text-align: left; margin: 0em; line-height: 12pt; background-color: white; border-style: none; padding: 0px;">    &lt;Final/&gt;</pre>
<!--CRLF-->
<pre style="font-size: 8pt; overflow: visible; font-family: 'Courier New', courier, monospace; width: 100%; color: black; direction: ltr; text-align: left; margin: 0em; line-height: 12pt; background-color: #f4f4f4; border-style: none; padding: 0px;">  &lt;/SyncBody&gt;</pre>
<!--CRLF-->
<pre style="font-size: 8pt; overflow: visible; font-family: 'Courier New', courier, monospace; width: 100%; color: black; direction: ltr; text-align: left; margin: 0em; line-height: 12pt; background-color: white; border-style: none; padding: 0px;">&lt;/SyncML&gt; </pre>
<!--CRLF--></div>
</div>
<p>You will notice that although the SyncML response looks syntactically correct and is visually very appealing, the XML parser tries to parse the above XML but actually fails with a XML parsing error! When the parsing error happens, the MDM Client just fails silently and the parsing error does not get relayed back to the server in the form of a HTTP request.</p>
<p>To resolve the problem and avoid the headaches of trying to comprehend why the MDM Agent does not communicate back to your server, you must ensure that your HTTP server response MUST be sent back as a single line without any extra spaces or new lines between the XML tags. Taking the above as an example, your &ldquo;XML parser friendly response&rdquo; MUST look like this:</p>
<div id="codeSnippetWrapper" style="font-size: 8pt; overflow: auto; cursor: text; height: 55px; font-family: 'Courier New', courier, monospace; width: 97.5%; direction: ltr; text-align: left; margin: 20px 0px 10px; line-height: 12pt; max-height: 200px; background-color: #f4f4f4; border: silver 1px solid; padding: 4px;">
<div id="codeSnippet" style="font-size: 8pt; overflow: visible; font-family: 'Courier New', courier, monospace; width: 100%; color: black; direction: ltr; text-align: left; line-height: 12pt; background-color: #f4f4f4; border-style: none; padding: 0px;">
<pre style="font-size: 8pt; overflow: visible; font-family: 'Courier New', courier, monospace; width: 100%; color: black; direction: ltr; text-align: left; margin: 0em; line-height: 12pt; background-color: white; border-style: none; padding: 0px;">&lt;SyncML xmlns=<span style="color: #006080;">"SYNCML:SYNCML1.2"</span>&gt;&lt;SyncHdr&gt;&lt;VerDTD&gt;1.2&lt;/VerDTD&gt;&lt;VerProto&gt;DM/1.2&lt;/VerProto&gt;...other elements...&lt;/SyncHdr&gt;&lt;SyncBody&gt;&lt;Status&gt;...other elements...&lt;/Status&gt;&lt;Replace&gt;...other elements...&lt;/Replace&gt;&lt;Get&gt;...other elements...&lt;/Get&gt;&lt;Final/&gt;&lt;/SyncBody&gt;&lt;/SyncML&gt;</pre>
<!--CRLF--></div>
</div>
<p>Hopefully this blog helps get you over the very first hurdle in the MDM implementation puzzle &ndash; which looks quite daunting at first, but then it&rsquo;s quite simple&hellip;or not :)</p>
<p>Until your next MDM issue, wishing you good luck!</p>
<p>- Prashant H Phadke</p>]]></content:encoded>
    </item>
    <item>
      <title>Sending Facebook invites from a Universal Windows app</title>
      <link>https://docs.microsoft.com/archive/blogs/wsdevsol/sending-facebook-invites-from-a-universal-windows-app</link>
      <pubDate>Thu, 30 Apr 2015 03:00:00 GMT</pubDate>
      <dc:creator><![CDATA[Matteo Pagani]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/wsdevsol/2015/04/30/sending-facebook-invites-from-a-universal-windows-app/</guid>
      <description><![CDATA[In one of the previous posts published on this blog we’ve learned how to integrate Facebook in a...]]></description>
      <content:encoded><![CDATA[<p>In one of the <a href="https://blogs.msdn.com/b/wsdevsol/archive/2015/02/12/integrating-facebook-authentication-in-universal-windows-apps.aspx" target="_blank">previous posts</a> published on this blog we’ve learned how to integrate Facebook in a Universal Windows app. Specifically, we’ve seen how to integrate the Facebook authentication, so that we are able to create a Universal Windows app where the user can login with his Facebook credentials, so that we can use the Graph APIs to interact with the social network and perform operations like retrieving the user’s profile or posting on his timeline. </p>  <p>For security reasons, there are some activities on Facebook (like sending invites for games or applications to a friend) that can’t be performed directly by calling some APIs, but they need to be managed with a web view that is offered by Facebook. The purpose of this approach is to avoid, for example, that an application could send automatically hundreds or thousands of invites without the explicit permission of the user. However, the developer has access to some tools to properly generate the web view and to receive the information about the outcome of the operation made by the user (like the list of friends that have been invited).</p>  <p>In this post we’re going to see how to integrate Facebook invites in a Universal Windows app, by reusing the knowledge we’ve acquired <a href="https://blogs.msdn.com/b/wsdevsol/archive/2015/02/12/integrating-facebook-authentication-in-universal-windows-apps.aspx" target="_blank">in the previous post</a> about integrating the Facebook authentication mechanism.</p>  <h3>Register the application on the Facebook developers’ portal</h3>  <p>The first step, before writing some code, is to properly configure the Facebook application which we have created <a href="https://blogs.msdn.com/b/wsdevsol/archive/2015/02/12/integrating-facebook-authentication-in-universal-windows-apps.aspx" target="_blank">in the previous post</a> and that it’s connected to the Windows application. It’s important to remember that every application (no matter if it’s a website, a mobile app or a desktop app) that needs to interact with the Facebook APIs needs to be properly registered in the developers’ portal provided by the social network. In this post we’re going to reuse the same application we’ve created in the previous post to support the authentication. In addition to the configuration we already did, we need to perform a few additional steps:. The trick to to integrate Facebook invites, in fact, is to treat the application like if it’s a web game, which has its own Facebook canvas (which is the area where Facebook renders the web application inside its pages). Every Facebook canvas is associated to a unique URL, which is invoked after that the procedure to send invites is completed: thanks to this URL, we’ll be able to determine the status of the operation and to retrieve the list of invited friends.</p>  <p>To configure the Facebook canvas we need to click, in the <strong>Settings </strong>section of our Facebook app, the <strong>Add</strong> <strong>platform</strong> button and add a new application, which type is <strong>Facebook Canvas</strong>. The only setting we need to setup is called <strong>Secure Canvas URL, </strong>which is the address that is invoked by Facebook when the operation is completed. We can use any custom URL; the only requirement is that it has to use the HTTPS protocol, like in the following sample.</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/85/metablogapi/2273.image_6BF4C7A0.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-85-metablogapi/2273.image_5F00_6BF4C7A0.png"><img title="Configuration of the Facebook Canvas" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="Configuration of the Facebook Canvas" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/85/metablogapi/4113.image_thumb_4FE69966.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-85-metablogapi/4113.image_5F00_thumb_5F00_4FE69966.png" width="531" height="279" /></a></p>  <p>&#160;</p>  <p>Now we are ready to write some code and to integrate invites in the Windows app.</p>  <h3></h3>  <h3>Display the web view</h3>  <p>To show the code that is needed to display the invites’ view we’re going to reuse the project we’ve created <a href="https://blogs.msdn.com/b/wsdevsol/archive/2015/02/12/integrating-facebook-authentication-in-universal-windows-apps.aspx" target="_blank">in the previous post</a>. I’ll take for granted that you’re already familiar with the <strong>FacebookClient</strong> and <strong>WebAuthenticationBroker</strong> classes and that you’ve already used them to perform the authentication and to retrieve the access token, which is needed to perform any further interaction with the Graph APIs.</p>  <p>For our purposes we’re going to use again the <strong>FacebookClient</strong> class, which is included in the Facebook SDK that you can install in your project by using <a href="https://www.nuget.org/packages/Facebook/" target="_blank">NuGet</a>. It’s important to remember, at this point, that, in a Universal Windows app, the shared project is just a “placeholder” for all the files that are needed by the application and not a real class library. Consequently, you’ll have to add the Facebook SDK both to the Windows and Windows Phone projects.</p>  <p>The <strong>FacebookClient</strong> class offers a method called <strong>GetDialogUrl()</strong> which, given as parameter the kind of dialog we want to display, returns the URL we need to display inside a web view. Since we are in a Universal Windows app, we’re going to use the <strong>WebView</strong> control to achieve this goal.</p>  <p>The following sample shows how to use the <strong>GetDialogUrl()</strong> method:</p>  <pre class="brush: csharp;">private void OnInviteFriendsClicked(object sender, RoutedEventArgs e)
{
    FacebookClient client = new FacebookClient(AccessToken);
    dynamic parameters = new ExpandoObject();
    parameters.app_id = ClientId;
    parameters.message = &quot;Invite your friends&quot;;
    parameters.title = &quot;Invite friends&quot;;
    parameters.redirect_uri = &quot;https://wp.qmatteoq.com/&quot;;

    Uri dialogUrl = client.GetDialogUrl(&quot;apprequests&quot;, parameters);
    RequestView.Visibility = Visibility.Visible;
    RequestView.Navigate(dialogUrl);
}</pre>

<p>The parameters to pass to the <strong>GetDialogUrl()</strong> method are managed with a <strong>dynamic</strong> object, which is defined with the following properties:</p>

<ul>
  <li><strong>app_id</strong> is the identifier of the Facebook application, which you can retrieve from the Facebook developers’ portal and that we have already used, <a href="https://blogs.msdn.com/b/wsdevsol/archive/2015/02/12/integrating-facebook-authentication-in-universal-windows-apps.aspx" target="_blank">in the previous post</a>, to perform the login. You can find it in the <strong>Settings</strong> page of the application; the field is called <strong>App ID.</strong> </li>

  <li><strong>message: </strong>it’s the message that explains to the user the purpose of the invites and it’s displayed in the web view. </li>

  <li><strong>title:</strong> it’s the title of the web view. </li>

  <li><strong>redirect_uri: </strong>it’s the Secure Canvas URL, which we have specified in the beginning of the post. </li>
</ul>

<p>After we’ve properly configured the parameters, we can pass them to the <strong>GetDialogUrl()</strong> method, together with the kind of dialog we want do display. In this case, since we’re working with invites, we need to use the <strong>apprequests</strong> identifier. In return, we receive the URL of the view to display in a <strong>WebView</strong> control, which has been added to the page of our application, like in the following sample:</p>

<pre class="brush: xml;">&lt;Grid&gt;
    &lt;WebView x:Name=&quot;RequestView&quot; Visibility=&quot;Collapsed&quot; Width=&quot;400&quot; Height=&quot;800&quot; NavigationCompleted=&quot;RequestView_OnNavigationCompleted&quot;/&gt;
    &lt;StackPanel Margin=&quot;12, 20, 0, 0&quot; x:Name=&quot;AppContent&quot;&gt;
    &lt;!-- the content of the page --&gt;
    &lt;/StackPanel&gt;
&lt;/Grid&gt;</pre>

<p>When we call the <strong>GetDialogUrl() </strong>method we also take care of displaying the <strong>WebView</strong> (which, by default, is hidden), by setting the <strong>Visibility</strong> property to <strong>Visible</strong>. Then, we call the <strong>Navigate()</strong> method of the <strong>WebView</strong> control, passing as parameter the<strong> </strong>URL returned by the <strong>GetDialogUrl()</strong> method. The application will display a view similar to the following one:</p>

<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/85/metablogapi/4532.image5_7B2DC11E.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-85-metablogapi/4532.image5_5F00_7B2DC11E.png"><img title="image" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/85/metablogapi/2821.image5_thumb_1CACF0AE.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-85-metablogapi/2821.image5_5F00_thumb_5F00_1CACF0AE.png" width="247" height="448" /></a></p>

<h3></h3>

<h3>Process the invitations</h3>

<p>In the web view the user will have the chance to select one of more his friends. After pressing the <strong>Send</strong> button, the operation will be completed and the invites will be sent. From the Facebook point of view, the operation is completed; however, as developers, we probably want to know more details about the outcome, like the list of friends that have been invited to use the application. We can achieve this goal by subscribing to the <strong>Navigation_Completed</strong> event of the <strong>WebView</strong> control, which is triggered when a web page is fully loaded.</p>

<p>After that the user has pressed the <strong>Send</strong> button, Facebook invokes the URL that we have defined as Secure Canvas URL in the app configuration. It’s the URL we need to intercept in the <strong>Navigation_Completed</strong> event to understand when the operation is completed. In this scenario, in fact, the URL will contain the list of all the friends that have been invited. Let’s take a look at the following sample code:</p>

<pre class="brush: csharp;">private async void RequestView_OnNavigationCompleted(WebView sender, WebViewNavigationCompletedEventArgs args)
{
    if (args.Uri.DnsSafeHost == &quot;wp.qmatteoq.com&quot;)
    {
        sender.Visibility = Visibility.Collapsed;
        AppContent.Visibility = Visibility.Visible;

        FacebookClient client = new FacebookClient(AccessToken);
        dynamic result = client.ParseDialogCallbackUrl(args.Uri);

        if (result.error_code == null)
        {
            var items = (IDictionary&lt;string, object&gt;) result;

            ObservableCollection&lt;FacebookUser&gt; invitedFriends = new ObservableCollection&lt;FacebookUser&gt;();

            foreach (KeyValuePair&lt;string, object&gt; value in items)
            {
                if (value.Key != &quot;request&quot;)
                {
                    string query = string.Format(&quot;/{0}&quot;, value.Value);
                    dynamic user = await client.GetTaskAsync(query);
                    FacebookUser facebookUser = new FacebookUser();
                    facebookUser.FullName = user.name;
                    invitedFriends.Add(facebookUser);
                }
            }

            Friends.Visibility = Visibility.Visible;
            FriendsHeader.Visibility = Visibility.Visible;
            Friends.ItemsSource = invitedFriends;
        }
        else
        {
            MessageDialog dialog = new MessageDialog(&quot;The user has canceled the operation&quot;);
            await dialog.ShowAsync();
        }
    }
}</pre>

<p>If the Uri of the page loaded by the <strong>WebView</strong> control is the same we have defined in the Facebook developers’ portal as Canvas Secure Url, it means that the operation is completed and we need to parse the result. The parsing procedure is simplified by a method offered by the <strong>FacebookClient</strong> class called <strong>ParseDialogCallbackUrl()</strong>, which requires as input parameter the full Uri of the page and returns a dynamic object (we use, again, the <strong>dynamic </strong>keyword to store the result). The first step is to check if the operation has completed successfully. In this case, the <strong>error_code</strong> property of the result will be empty, otherwise, it means that the operation has been cancelled by the user (the web view, in fact, offers also a Cancel button, which can be used to abort the operation). If it’s not the case, we can move on and retrieve the list of invited users. We are able, in fact, to manage the result as a <strong>Dictionary&lt;string, object&gt;</strong> collection, which contains:</p>

<ul>
  <li>As first value, an item identified by the <strong>request</strong> key, which contains the unique identifier of the request. </li>

  <li>A series of numeric values: each of it is the unique Facebook identifier of the friends invited by the user. </li>
</ul>

<p>In the sample code we process all the items of the collection with a <strong>foreach</strong> iterator; we discard the item identified by the <strong>request</strong> key (since we don’t need it for our purposes) and we use only the ones with the Facebook identifier. For all the friends that the user have invited, we issue a request to the Graph APIs to retrieve the friend’s profile. We use the <strong>GetTaskAsync()</strong> method of the <strong>FacebookClient </strong>class, passing as parameter the Graph API’s path (which is simply the symbol <strong>/</strong> followed by the identifier of the user, like <strong>/123456789</strong>).</p>

<p>In the end, it’s up to us to decide what we want to do with this information. In the previous sample, we create a new <strong>FacebookUser</strong> object (which is a custom class) for each friend and we store, in the <strong>FullName</strong> property, the name of the friend that we have retrieved using the Graph API. Here is a sample definition of the <strong>FacebookUser</strong> class:</p>

<pre class="brush: csharp;">public class FacebookUser
{
    public string FullName { get; set; }
}</pre>

<p>All these objects are included in a collection called <strong>invitedFriends</strong>, which type is <strong>ObservableCollection&lt;FacebookUser&gt;.</strong> This way, by using a <strong>ListView</strong> control, we can display to the user the list of the names of all the friends he has invited in the web view. The following code shows the simple template used for the <strong>ListView</strong> control:</p>

<pre class="brush: xml;">&lt;ListView x:Name=&quot;Friends&quot; Margin=&quot;0, 20, 0, 0&quot; Visibility=&quot;Collapsed&quot;&gt;
    &lt;ListView.ItemTemplate&gt;
        &lt;DataTemplate&gt;
            &lt;StackPanel&gt;
                &lt;TextBlock Text=&quot;{Binding Path=FullName}&quot; Style=&quot;{StaticResource BodyTextBlockStyle}&quot; /&gt;
            &lt;/StackPanel&gt;
        &lt;/DataTemplate&gt;
    &lt;/ListView.ItemTemplate&gt;
&lt;/ListView&gt;</pre>

<h3>Wrapping up</h3>

<p>In this post we have seen how to integrate Facebook invites in our Universal Windows app. You can download the sample code we’ve seen in this post from the following repository on GitHub: <a href="https://github.com/qmatteoq/FacebookSample-Universal">https://github.com/qmatteoq/FacebookSample-Universal</a>. It’s important to remember that, before using the sample, you’ll have to change the various Facebook parameters (like the App Id or the Canvas Secure URL) with the ones you have configured for your application in the Facebook developers’ portal.</p>

<p>Follow the Windows Store Developer Solutions team on Twitter <a href="https://twitter.com/wsdevsol">@wsdevsol</a>. Comments are welcome, both below and on twitter</p>]]></content:encoded>
    </item>
  </channel>
</rss>