Archive for May, 2017

Invalid resx File Windows XP Only

Wednesday, May 24th, 2017

Invalid resx File in C# .NET Solution on Windows XP Only

If a c# application you've developed that targets the .NET Framework version 4.0 crashes on Windows XP but does NOT crash on Windows Vista through Windows 10, it is most likely due to an embedded resource issue (in one of the .resx files in the solution).  Upon opening the solution of my problematic program in Visual Studio 2010 on Windows XP, I received an error similar to the following:

Invalid resx file. Command completed successfully. Could not load type...

I fixed the issue by deleting one of my icon (.ico) files from the solution that was 256 x 256 pixels and replaced it with the same icon with a size of 255 x 255 pixels.  While a 256 x 256 pixel icon file is perfectly valid in newer versions of Windows, the maximum size of an .ico file can only be 255 x 255 on Windows XP x86 SP3.  I still target XP machines since I have a Netbook with it that will always be running XP.