20 December, 2012

VS 2010 theme, color and icons, in VS 2012

So after some time I decided it was finally time to switch from Visual Studio 2010 to 2012 as my default development IDE, the reason I waited was simply because the new UI (colors and theme in general) was simply slowing me down.

I have a long time ago learned that the human brain is faster at recognizing images and patterns than reading text, you properly all have tried the test that was a National Geographic TV ad a couple of years ago, where only the first and last letter of each word was in the correct place, and still the brain was "reading" the words and entire text correctly. I think it was a excellent demonstration of how the brain sees patterns and tries to make logic of none-logic images of the world around us.

So the new UI in VS 2012 is a gray, although in different shades of gray, single blob/mass, and actually I spent most of my time just trying to recognize the icons over-and-over again, I have simply come to familiar with the icons colors as a reference of where the "actions" I need to perform are located. ex. I tried to not put Icons with the same colors, but different functions up against each other, and if I do it normally means that the functions behind the icons are doing almost similar actions, and my brain knows (with out me think about it) that the third icon does something different than the first two icons. So when using any of the tools that I'm accustom to use, I don't "think" about the position of colors of the icons, my brain simply reuses the pattern it already knows for activating that function.

Besides that Microsoft decided that the top menu should be in all UPPERCASE letters, come on.... everyone with just a little UI experience knows that uppercase text is MUCH harder to read than normal captions text, but why is that ? Well I think again it comes down to the pattern that the brain has to translate into something meaningful, properly cultures with symbol like alphabet like Chinese will have a faster reading rate with uppercase letters than cultures with a latin based alphabet, where we are used to using lowercase letters for most text. Of course we could "teach" or learn our brain to become familiar with the UPPERCASE style of the menus, but seriously Visual Studio is not a UI playground where new and un-proven UI interface adaptations should be implemented.

So I have been trying to find some plugins/extensions/hacks that could "bring back" a more familiar UI. and so far I have come up with the following setup that gives me a interface that can work for me, and if your also need it just follow the guide :-)



  • Install the NiceVS extension that makes the top menu into correct Title case again.
  • Download the Visual Studio Icon Patcher this is not a VS extension or plugin but is required to be run from a command line, unfortunately the guides are not 100% clear on how to actually do this correctly. So i put in here a little step-by-step guide, however it requires that you have VS 2010 installed
  1. Shutdown all visual studio instances
  2. Start a DOS command prompt
  3. Navigate to the folder where you have extract the Visual Studio Icon Patcher files
  4. Run the following commands one-by-one
  5. vsip.exe extractmode
  6. vsip.exe backup -v=2010 -f (backup your VS 2010 files, just in case)
  7. vsip.exe backup -v=2012 -f (backup your VS 2012 files, just in case)
  8. vsip.exe extract -v=2010 (extract the required icons etc. from your VS 2010 install)
  9. vsip.exe inject (this will replace the files from the VS 2010 extraction into VS 2012)
And you should now be done and have a VS 2012 where most (not all) icons, colors and theme are familiar to work with.

I certainly helped my transition to 2012 a lot, so instead of focusing on where the DAMM actions/icons are located, and what they look like now, I can focus on developing and solving real-world business issues that I'm loving..... 

Have a great Christmas....

My First Computer

I just by chance stumbled upon a wiki link to my very first "PC", Amstrad CPC, the 1000 of hours I spent on that thing, playing games and doing code in BASIC. But my the most surprising thing is trying to explain to my 9 year old soon, how it worked and especially how the tape-drive worked (and what a tape actually is)  I tried to find a tape in our house but no more tapes exists apparently they have all been taken away by the sands of time :-)

(I'm getting old....)


Webservice (asmx) invoke method error after upgrade to .NET 4 (disable compression)

After upgrading some of our old webprojects to .NET 4, we stumbled upon some strange errors when invoking asmx webservice methods. We got all kinds of strange responses back from the server and also on localhost the responses was looking realy strange.


Response in IE9:
"Http 500 Internal Server Error"
The website cannot display the page

Response in Chrome:
This webpage is not found
Error 6 (net::ERR_FILE_NOT_FOUND): The file or directory could not be found.

Response in FireFox:
� ����� �� ` I�%&/m�{J�J��t� �` $ؐ@ ����� iG#)�*��eVe]f @�흼��{���{��;�N'���?\fd l��J�ɞ!��� ?~| ?"^_7m� 7���ݶ�W�/Z�M�YY̲������
�<J��U��˶���:�eˋ���M�U�"���u�^eM:��|��� i;��iY���ֻE�4k��~�/ZW��/,�Ó�n��N�e� � �G��X��3���4M�6�#<V���m],/��`3J�iU�� 
��ʯG o7��պ��i-����wn��l��$zt�nE>K���o����A�X��y}YL�f�ڊ �л� �_f5����<��� ?�<� �[�mW�8��g ���� ?�X?�v�����IU��=5k 7�� ����77�{� ��


We tried debugging the code, but none of the breakpoints was hit, no event log errors, just a strange response from the webserver. So we googled around to see if this was a know bug, but unfortunately not most was found that helped us out, however a lot issues poped up that looked related but in the end was not, apparently not many are upgrading old asmx webservices to a .NET 4 website.

After testing various solutions and combinations of ideas finally we found out that the root bug was hidden for us behind the a response filter that was handling the GZIP/DEFLATE compression of the response. So we disabled the compression on that path/folder and then the root cause was clear, it was the requestValidationMode it needed to be set to: <httpRuntime requestValidationMode="2.0" />

This bug took the most part of a day to fix, so the leason is:
Allways disable HTTP Compression when debugging.

Some reference sources of problem:
stackoverflow.com/.../resource-not-found-when-trying-to-invoke-web-service-method
stackoverflow.com/.../invoke-of-asmx-webmethod-fails-with-xmlexception
go4answers.webhost4life.com/./invoke-web-service-get-http-404-object-209471


An attempt was made to load a program with an incorrect format

On 64 bit versions of windows you can recive an anoying error stating that "An attempt was made to load a program with an incorrect format".

This can sometimes be caused by the fact that you are trying to reference a 64 bit dll in a 32 bit project, but it can strangely enough also be caused by a bug in VS 2010 involving resx files.

I gathered a few reference links, about the issue:
stackoverflow.com/.../an-attempt-was-made-to-load-a-program-with-an-incorrect-format
connect.microsoft.com/VisualStudio/feedback/details/532584/....
msdn.com/b/visualstudio/.../resgen-exe-error-...-program-with-an-incorrect-format
stackoverflow.com/..../could-not-load-file-or-assembly-or-one-of-its-dependencies

I ran into this problem a few times, after any resource (resx) files was modified, and decided to find a solution that would work, and could be put inside the project/solution build cycle.

Add to the project "pre-build" event
FORFILES /P $(ProjectDir) /M *.resx /S /C "CMD /C RegexConsole.exe @path \"AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w\" \"AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj0yLjAuMC4w\" I"

It's important the the line of code is on a single line and that the RegexConsole.exe file is placed in a accesable path, put it in the system32 folder or another global %PATH% registered location.

Downloads:
VS-Fix-resx-files-pre-build-event.txt
RegexConsole.exe