Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.NET 4 Program written/compiled on Windows 7 machine won't run on XP

I have an app that I wrote using C# .NET 4.0 in Visual Studio 2010 on my Windows 7 Ultimate machine. This app works fine on both Vista and other Windows 7 computers, but whenever someone running Windows XP tries to run it it crashes.

In order to reproduce this I've tried running it on my Win XP VMWare machine and it crashes for me in there. Unfortunately it doesn't give me any specific error, just informing me that the program has crashed and needs to close.

One other user sent me the following:

Run-time error '339'
Component 'vbalSGrid6.ocx' or one of its dependencies not correctly registered: a file is  missing or invalid.

Code 0xe0434352
Flags 0x00000001

I don't get that particular bit when I try to run it on my Virtual XP machine, and I also made sure to install .NET 4.0 on there.

What could be causing this, and why won't the app run in XP if the .NET 4 framework is supported for XP?

Components used in the program: DataGridView, ComboBox, Buttons, Labels, LinkLabel, NewtonSoft's JSON parser, and that's about it.

I am baffled and have utterly no idea where to start. Ideas?

UPDATE: Hmm, tried running my other recently created application on XP and it loaded fine. The only major difference (in the components I used anyway) between the two is my use of NewtonSoft's JSON library, which I actually think is a .NET 3.5 component.

UPDATE 2: Just for kicks I tried running the program on my Wind7 machine in "Windows XP SP3" compatibility mode and it ran fine. Of course, I have no idea just how closely the "compatibility mode" emulates a true XP SP3 environment, but I figured I'd give ya'll the info anyway.

like image 607
Sootah Avatar asked Feb 20 '11 02:02

Sootah


2 Answers

¡¡ IT WAS THE APPLICATION ICON !!

I kept noticing that the module it referenced in the error it gave me was system.drawing which I thought was odd. I figured perhaps the PictureBox I was using was causing the issue, so I tried disabling everything to do with that, to no avail.

I had my business partner set up his XP box so that we'd have another machine to test with aside from my VMWare XP box just in case there was some odd issue with it.

After he got it set up and the app copied over he said "The icons look like DOS ones" and I had a eureka moment.

I was using .PNG's as the icons because they support transparencies and whatnot, but XP doens't natively support them. So when the app was copied to the desktop it just used a generic icon for it, and when the application was run it crashed because XP doesn't know how to render a .PNG.

like image 101
Sootah Avatar answered Nov 15 '22 04:11

Sootah


Try using the Fusion Log Viewer to debug startup errors in .NET applications.

Scott Hanselman has written a nice howto along with links to further resources if you need to go deeper.

like image 21
Ben Voigt Avatar answered Nov 15 '22 04:11

Ben Voigt