Category Archives: Windows 8

VS2013: upgrading a Windows Phone 7/8 and Windows 8 apps

In this post I will showcase issues I had while upgrading a Visual Studio 2012 solution containing a Windows Phone app (with both 7.8 and 8.0 versions) and Windows Store app to Visual Studio 2013.

As you probably already know, the Release Candidate version of VS2013 was released a few days ago and I decided it was the appropriate time to upgrade my 2Day todo-list application. Because 2Day for Windows will target the 8.1 release (coming October 18th, now available for MSDN subscribers) I needed to perform this upgrade before the release.

Windows Phone 7.x support

The first issue is simple and yet sad: Visual Studio 2013 is dropping support for Windows Phone 7.x app.  I guess it makes sense when given the fact the WP8 devices represent more than 65% of the total of Windows Phone device (see this AdDuplex blog post for more details).I can also confirm this trend that by looking at 2Day’s data for last week:

2Day devices chart

Since I released the first version of 2Day I submitted 14 updates. Starting from 2Day 1.4 I  released all updates for both WP7 and WP8 devices. It looks like the 2.1 update coming later this month will be the last one targeting WP7 devices.

Windows Phone support Conclusion: upgrade to VS2013 imply no more WP7 support. You can try to maintain 2 solutions but we will see in the next paragraph that there are other issues with Portable Class Libraries.

Portable Class Libraries (PCL)

2Day’s Visual Studio 2012 solution contains Portable Class Libraries to enable code reuse between Windows Phone and Windows 8 (it was also helping code sharing between WP7 and WP8 versions). In Visual Studio 2013, like we saw before, support for WP7 is now longer available, including for PCLs:

VS2013 PCL

So opening a solution that contains PCLs targeting WP7 will upgrade those PCLs and drop targeting of WP7.

Also, in order to target WP7 and have async/await support I had to use the Async BCL NuGet package:

BLC Async Support

Because the async support is now supported in the frameworks I target (Windows 8.1 and Windows Phone 8), I must remove those packages in order to prevent conflicts like the following:

Error 28 The type 'System.Threading.Tasks.Task<TResult>' exists in both 'c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETPortable\v4.0\Profile\Profile158\mscorlib.dll' and '...\packages\Microsoft.Bcl.1.0.19\lib\portable-net40+sl4+win8+wp71\System.Threading.Tasks.dll'

While doing those upgrades I also ended up target .Net 4.5, and it turns out the reflection API has some changes in the latest version of .Net.  If you’re like me you’re a fan of SOLID principles, you probably have some kind of Inversion of Control container using reflection… In my case the following code was not working anymore:

var constructor = typeof(T).GetConstructors().FirstOrDefault();

And I had to use the new reflection API:

var constructor = typeof(T).GetTypeInfo().DeclaredConstructors.FirstOrDefault();

You can read this complete post on the blog of the .Net team for more details about the evolution of the reflection API.

PCL Conclusion: be careful when you upgrade PCL projects to VS2013. Because WP7 support is gone, you don’t need the Async BCL NuGet package anymore. If you choose to target .Net 4.5 beware of possible breaking changes in the reflection API.

General conclusion: if like me your original plan was to target WP7, WP8 and Windows 8.1 withing a single Visual Studio solution, you’re in trouble. My decision is to drop support for WP7 devices for the next update of my app. I guess I could go with branching in TFS to keep compatibility but I don’t have time for that. Be also careful with PCLs and the new reflection API.

 

Welcome 2013 :-)

This is the perfect time to take a look at what happened in the last few months as well as what’s on the roadmap for next year. So let’s start by taking a look at 2012…

Events

techdays12

  • In November, I gave a presentation about Windows Phone 8 at SFEIR Plays

sfeir plays

Blog posts

The last year I blogged mostly about Windows Phone stuff. This is not a surprise as I’m busy (on my personal time…) working for my 2Day todo-list application. I’m finalizing a major release that should be submitted to the marketplace soon with a ton of new features and improvement (several blog posts should highlight some topics from a developer point of view).

Here is the full list of article (oldest first):

Next year

2013 should very busy too :-)

  • In mid-February, I will speak again during the TechDays in Paris. The topic is the same as last year: performance optimization for Windows Phone applications. However, with Windows Phone 8 we’ve plenty of new topics to cover !
  • In late-February I will fly to Redmond for the MVP Summit 2013. It will be my sedond time there. As aways, all the content will be under NDA… I will share a room with my friend Jose Fajardo I met at //BUILD/ 2011 !
  • In March, I should setup an event with my company and Microsoft in Grenoble talking about Windows 8 and Windows Phone 8

I’m still deeply invested with 2Day so hopefully you should see more tips and tricks about Windows Phone. As a Windows 8 version is also on its way, that should give me many reasons to write new blog posts.

Happy new year dear readers !

 

 

 

Hacking for fun: porting a Silverlight Windows Phone app to WinRT in 9hours


Warning: count(): Parameter must be an array or an object that implements Countable in /homepages/5/d143877862/htdocs/japf/wp-content/plugins/wp-codebox/main.php on line 31

Fatal error: Uncaught Error: Call to undefined function eregi() in /homepages/5/d143877862/htdocs/japf/wp-content/plugins/wp-codebox/main.php:136 Stack trace: #0 /homepages/5/d143877862/htdocs/japf/wp-content/plugins/wp-codebox/main.php(75): wp_codebox_is_windowsie() #1 /homepages/5/d143877862/htdocs/japf/wp-content/plugins/wp-codebox/main.php(50): wp_codebox_highlight_geshi(Array) #2 [internal function]: wp_codebox_highlight(Array) #3 /homepages/5/d143877862/htdocs/japf/wp-content/plugins/wp-codebox/main.php(130): preg_replace_callback('/<p>\\s*6492d583...', 'wp_codebox_high...', '<p>Today I woke...') #4 /homepages/5/d143877862/htdocs/japf/wp-includes/plugin.php(213): wp_codebox_after_filter('<p>Today I woke...') #5 /homepages/5/d143877862/htdocs/japf/wp-includes/post-template.php(221): apply_filters('the_content', '<p>Today I woke...') #6 /homepages/5/d143877862/htdocs/japf/wp-content/themes/twentythirteen/content.php(39): the_content('Continue readin...') #7 /homepages/5/d143877862/htdocs/japf/wp-includes/template.php( in /homepages/5/d143877862/htdocs/japf/wp-content/plugins/wp-codebox/main.php on line 136