Beware Of Visual Studio Proxy Migrations

I recently moved a C# code project from Visual Studio 2010 on Windows 7 to Visual Studio 2012 on Windows 8.  Theoretically, this should have resulted in no problems and code that just works from the start.  But that’s not the way it turned out.

The project in question was a Web project that included proxy code used to interface with Amazon’s Product API.  Visual Studio 2012 started reporting the following error, “Cannot implicitly convert type ‘Exploricity.Amazon.ECS.ImageSet[][]’ to ‘Exploricity.Amazon.ECS.ImageSet[]’.”

Since I have the source code under version control I was able to determine what files Visual Studio modified and what those changes were.  I found that the Reference.cs file in the Amazon.ECS folder contained a ton of changes.  Most were innocuous generated code changes that reflect the version of various system assemblies:

[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.0.30319.17929")]

But there was also this change:

public ImageSet[][] ImageSets

Visual Studio attempted to regenerate the proxy code and did so in such a way that broke it by making ImageSets a two dimensional array instead of keeping it as the single dimensional array it was before.

One of the takeaways from this is the importance of version control, even for small personal projects like this one was for me.  It made finding out what the problem was and resolving it a much easier task.

This entry was posted in Programming and tagged . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *