Windows Mobile 10 – The stepping stone or the tombstone?

Windows-10-MobileMicrosoft has struggled with their smart phone strategy (and market shares). Due to a rather customer-hostile  but strategic important decisions (to shift to Intel-core) most customers investing in a Lumia (in the days on WP 7) received a cold shoulder from Microsoft and was stuck on WP 7 with no option to receive any further upgrades.

I bought my Lumia phone just two months before Microsoft announced that “Dear customer, we are leaving you behind. The phone we sold you is rubbish, so just buy a new phone again and we will be friends forever (meaning you will receive all future updates to our OS)”

My old IPhone 3GS on its side has lived through iOS 3,4,5 and 6. That is actually 4 major releases over more than 3 years before Apple announced its retirement! My Lumia was parked two months after I bought it……

Anyway, thats water under the brigde. This week I started testing Window Mobile 10 on my Lumia 925. The OS was downloaded through the Windows Insider Program, which turned out to be one of the easiest and best upgrade experiences I have ever been through!

Wether Windows 10 will be the stepping stone or the tombstone, is up to Microsoft strategic decisions, meaning, the choice to roll out Windows Mobile 10 to all current Windows Phone 8.1 Denim devices, or once again rather focus on selling new phones instead of trying to keep their current device owners happy! It is impossible to gain market shares if all customers have to buy a new phone for each new major OS upgrade. Apple seems to put its effort into making money on app-sales, while Microsoft (in the past) seemed to put its effort into making money on phone-sales. And we all know what pays off in the long run!

So is it the tombstone? Well, IF Microsoft decides to upgrade all Windows Phone 8.1 devices to Windows Mobile 10 fast, I think that WM 10 will be the stepping stone they have been trying to find since the release of Windows Phone 7.

Windows Phone 10 and Windows 10 (on your laptop) is suddenly quite similar, and Microsoft is putting down quite some effort in making us app developers port our apps from WP 8 to WM 10 by giving us free expert assistance from Microsoft consultants.

It has been Microsofts  a long term goal to get their OS jungle into one uniform platform across all devices (PC, phone, Xbox +++), and it is starting to look really good! The shift to Intel in Windows Phone 8 was an important early step!

The best parts of Windows Mobile 10 as I see it today:

  • The new 10-OS makes it easier to develop universal apps running on both PC, tablet and phones, making it much more lucrative for developers and companies to focus on Windows instead of iOS and android
  • WP 8 “Internet explorer” was terrible, and there was no good alternatives on the OS. Windows Mobile 10 received Edge, and a Windows phone has finally got a decent web browser!
  • Windows Mobile 10 has a great notification center which all decent smart phones need! In WP 8 we didn’t have something that worked…
  • WM 10 and Facebook has finally got a great integration on contacts!
  • The search functionality for apps is very good
  • “Recently Added” makes it easy to start using the new apps you install
  • The settings-search i is way better than what iOS and Android supports. Meaning that Windows Mobile is much simple to use and configure for “regular” people
  • Cortona is finally comparable to Siri on iOS
  • Windows Mobile 10 has great support for combining mail accounts in Outlook making it one uniform experience
  • Great support for multifunctional lock-screen. The lock-screen support in Windows Mobile 10 is much better than what iOS and Android supports.

Nobody can tell what the future brings, but Microsoft has at least done a great leap forward with Windows Mobile 10, and hopefully it will be the strategic decision they (and we needed) to make it a platform worth comparing to iOS and Android!

Using Kdiff3 as default merge tool on git

Git Bash is the preferred tool for handling your git repo. Diffs are however somewhat cumbersome to handle with a external tool. The best (and quickest) solution is to use Kdiff3 as your default merge tool.

Install Kdiff3, open Git Bash and run the following commands:

git config --global merge.tool kdiff3
git config --global mergetool.kdiff3.cmd '"C:\\Program Files\\KDiff3\\kdiff3" $BASE $LOCAL $REMOTE -o $MERGED'

Once this is set, whenever you get a conflict during pull, just run

git mergertool

All conflict not automatically resolved will open in Kdiff3 when pressing enter!

To get at better understanding of Git, all developers should have this book at hand:
Version Control with Git: Powerful tools and techniques for collaborative software development




QuickFix: Unable to boot Fedore Live USB

In case you experience the follow error trying to run a Fedora Live Fedora-CoreUSB:

vesamenu.c32: not a COM32R image

Three quick steps to make it work:

  1. Press Tab to list all options
  2. Hopefully you see linux0 listed.
  3. Type linux0 and press enter

It should now be able to boot the Fedora Live USB!

For a better understanding of Fedora: A Practical Guide to Fedora and Red Hat Enterprise Linux (7th Edition)


Wrong connection strings in Entity Framwork during migrations

I have a experienced some very strange problem with entity framework, which I have finally been able to reproduce in a small testsetup.

I have a subclass of DBContext called DataLyaetDataContext which contains my database defenition (code first)

public class DataLayerDataContext : DbContext
    public DataLayerDataContext(string connectionString) : base(connectionString)

    public DataLayerDataContext() : base(CreateConnectionString())

    public string ConnectionString
            return this.Database.Connection.ConnectionString;

    private static string CreateConnectionString()
        return "Data Source=.;Initial Catalog=Test.DefaultDb;Integrated Security=False;User ID=defaultUser;Password=defaultUserPwd1;MultipleActiveResultSets=True";

    public DbSet<Person> Persons { get; set; }
    public DbSet<Address> Addresses { get; set; }

    public void MigrateToLatestVersion(string connectionStringAdminToDb1)
        var migrationConfiguration = new Migrations.Configuration(connectionStringAdminToDb1);
        var migrator = new DbMigrator(migrationConfiguration);
        var pendingMigrations = migrator.GetPendingMigrations();

        if (!pendingMigrations.Any())
            // Nothing to do


Then I run this against several databases in paralell, just injecting the connection string to my DbContext like this

string connectionStringUserToDb1 = "Data Source=.;Initial Catalog=Test.DB1;Integrated Security=False;User ID=userdb1;Password=PasswordDb1;MultipleActiveResultSets=True";
using (var db1Context = new DataLayerDataContext(connectionStringUserToDb1))
   var persons = db1Context.Persons.ToList();

This works very good, and I can run several hundrer users in paralell and everything works fine!

I can also upgrade or check for upgrade on the databases with the following code

string connectionStringAdminToDb1 = "Data Source=.;Initial Catalog=Test.DB1;Integrated Security=False;User ID=userWithAdminRights;Password=PasswordAdmin1;MultipleActiveResultSets=True";
    using (var db1Context = new DataLayerDataContext(connectionStringAdminToDb1))
catch (Exception)
     Console.WriteLine("Failed during migration");                

When we start running this with load, we suddenly saw that some times when  a long running query against say DatabaseA started, and then a connection to another database say DatabaseB did a MigrateToLatestVersion before the query against DatabaseA was finished, the result from the query towards DatabaseA received some data from DatabaseB, eg. a result containing 2000 rows of data from DatabaseA contained 1-2 rows of data from DatabaseB as well!

If for some reason DatabaseB is in recovery mode or detached and we then try to run the MigrateToLatestVersion against it, all other queries against all other database will use the connectionstring (and connection) to DatabaseB until we restart IIS or restart the app running the testcode in my testexample here!

To test the example:

  1. Create the following users on your db-server u: userWithAdminRights p: PasswordAdmin1 (Need dbcreator rights on server)
  2. When you run the forms application you should be able to press “Setup Databases” and two new database should be created namely Test.DB1 and Test.DB2
    Also “Trigger Migration on …” buttons should work fine
  3. “Get From DB1” and “Get From DB2” should not work as we need the other two users(userdb1 and userdb2)
  4. Add two new database users u: userdb1 p: PasswordDb1 (On User Mappings add it to Test.DB1 with dbowner rights) u: userdb2 p: PasswordDb2 (On User Mappings add it to Test.DB2 with dbowner rights)
  5. Press “Get From DB1” and “Get From DB2” in the app to verify that it executes without errors
  6. Add a breakpoint in GetDataFromDb2 on the line var persons = db2Context.Persons.ToList();
  7. Press “Get From DB2” and inspect in the debugger that d2Context has connectionstring againt Test.DB2
  8. Stop the app, and take Test.DB1 offline
  9. Start the app again and press “Trigger Migration on DB1”. This should fail silently.
  10. Press GetFromDB2 and inspect db2Context when the breakpoint hits. And now it has NOT Test.DB2 connection but the wrong connection from Test.DB1
  11. If we have not taken the database offline, but run multiple executions in paralell (multiple threads) we would en up with the same scenario sometimes when an execution on one database takes long time while and migration check is done on the other database.

The source code can be downloaded here:

Update: This issue has been fixed in later releases of Entity Framework. Quite impressed by the support Microsoft gave on this issue! The fix was delivered within approx a week!

XMLSerializer error: Unable to generate a temporary class

Today users suddenly started reporting problems with a Windows C# .Net application, during working, the application suddenly stopped and would not start again. For me it seems like there has been an update in the Microsoft .Net Framework, or a Windows update that affects how Windows and the .Net Framework handles XML serialization/deserialization and compilation of the XmlSerializer. The error contains the following information:

System.InvalidOperationException: Unable to generate a temporary class (result = 1)

Internal compiler error (…) likely culprint is ‘IMPORT’

Internal Compiler Error: stage ‘IMPORT’

Stack trace should contain the following:

at System.Xml.Serialization.Compiler.Compile(Assembly parent, String ns, XmlSerializerCompilerParameters xmlParameters, Evidence evidence)
at System.Xml.Serialization.TempAssembly.GenerateAssembly(XmlMapping[] xmlMappings, Type[] types, String defaultNamespace, Evidence evidence, XmlSerializerCompilerParameters parameters, Assembly assembly, Hashtable assemblies)
at System.Xml.Serialization.XmlSerializer.GenerateTempAssembly(XmlMapping xmlMapping, Type type, String defaultNamespace)
at System.Xml.Serialization.XmlSerializer..ctor(Type type, String defaultNamespace)

Continue reading XMLSerializer error: Unable to generate a temporary class

Understanding IIS Server Logs

Trying to get valuable information from the IIS Server Logs can sometimes be rather difficult, as the logs are quite cryptic and not very verbose! But behind the cryptic numbers there are much information which could save you a lot of debugging time!

In the January version of MSDN Magazine there is a great article on this subject, written by Eduardo Sanabria where he decrypts a standard IIS Server Log. I strongly recommend that you read this article, but in case you just want a quick and easy to use overview, I created this cheat-sheet: Continue reading Understanding IIS Server Logs

Linking web pages to PDF documents


Liking web pages to PDF documents is quite simple. You basically have two options:

  1. Linking to page numbers
  2. Linking to named destinations

You can not link directly to bookmarks in PDF documents. Bookmarks can be added using Adobe Acrobat, or use the freeware JPdfBookmarks. But sadly these bookmarks can’t be linked to from external references.

Linking to page numbers

Find the correct page number and use the following reference in your html

<a href="http://<my domain>/<myfile>.pdf#page=<pagenumber>">My link text</a>

Linking to named destinations

In Adobe Acrobat, you can add named destionations which can be linked to from external references. Named destinations can be used like this:

<a href="http://<my domain>/<myfile>.pdf#nameddest=<mynameddest>">My link text</a>

To add named destinations you need a paid version of Adobe Acrobat, just follow these steps to add a named destination

  1. Open your PDF and find the desired location
  2. Navigate to View > Navigation Tabs > Destinations
  3. Choose Scan Document under Options
  4. Once completed, select New Destination and enter an appropriate name

Any problems? Just drop me a comment and I will elaborate!

.Net, C#, Scrum and agile software development