简体   繁体   中英

.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.

¡¡ 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.

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.

Are we sure this is some wierd .NET compatibility issue or just a run of the mill bad installer/deployment problem?

Here's one user who has that error message because the OCX DLL was copied to System32 with a shortname. Renaming the DLL to the correct name and running RegSvr32 resolved his problem.

Do you have an installer? Have you correctly identified all of your managed and unmanaged dependencies and properly authored them into your installer?

http://forums.elmsoftware.com/forum_posts.asp?TID=119

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM