0

I have a WinForm .NET 2.0 framework app that works fine in Vista, Win 7 and XP as long as the notifyicon component is not included. If I drop the component on the Form and recompile, Vista & Win 7 work fine, XP crashes immediately on launch. I put a logger in the program.cs to log if it ever makes it there and it doesn't. Same problem regardless of whether I compile in VS2008 or VS2010. Had coworker compile the project from her machine and bug is still there in XP only.

Take the notifyicon component off the form and everything works again in XP. I tried putting a notifyicon on other .NET 2.0 projects and they work so I'm not sure why just this project has issues.

On the XP machine I tried .NET 2.0 SP0 & .NET 2.0 SP2 with still the same issue. Strange...

GeoDirk
  • 17
  • 5
  • Have you got more information on the crash? – ChrisF Mar 03 '11 at 11:55
  • Could you post the relevant piece of code ? (the one using notify icon) – digEmAll Mar 03 '11 at 11:55
  • you post it twice! : http://stackoverflow.com/questions/4874586/what-could-prevent-a-notifyicon-from-working-in-windows-xp-when-it-works-fine-on – Rami Alshareef Mar 03 '11 at 11:57
  • 1
    @Rami: It's not the same person. GeoDirk originally posted an "answer" to that duplicate question, saying (s)he had the same problem. Realizing that's not how SO works, they posted it as a new question. – Cody Gray - on strike Mar 03 '11 at 12:14
  • 1
    @GeoDirk: Unfortunately, you've already solved your own problem. By adding a `NotifyIcon` component to *another* project targeting .NET 2.0, and *not* experiencing the same crash, you've isolated the bug to something in your original project. As others have mentioned, it will be impossible for us to point out the culprit unless you post the code or a stripped-down version of your project that reproduces the behavior. I'd love to help, but like the person who posted the original question, there just isn't enough information for me to do anything but idly sympathize. – Cody Gray - on strike Mar 03 '11 at 12:16
  • Yeah sorry about the double posting. I realized that my notifyicon issue was not the same as the other one so I deleted it and started a new topic. – GeoDirk Mar 05 '11 at 07:50
  • @Cody: My project is relatively small so I think I'll port it over to the winform that is working piece-by-piece and see if it works there. Maybe that way I can find out what the issue is. If not, then I'll post the code somewhere. – GeoDirk Mar 05 '11 at 07:53

1 Answers1

2

I've had an issue like this where the .ico file was at fault.

XP has some issues with compressed 256x256 images inside an ico.

Can you remove the ico from the NotifyIcon and see if the crash still occurs? The way we fixed it was to download IcoFx and uncompress the larger 256x256 icon size. This made the file significantly larger, but fixed our issue.

jonathanpeppers
  • 26,115
  • 21
  • 99
  • 182
  • Hi Jonathan: thanks for the heads up and I'll keep that in mind in the future, but that isn't the issue as I can get the error to occur if I only drop a new notifyicon onto the winform. The bug occurs without me setting any properties. – GeoDirk Mar 05 '11 at 07:55
  • Jonathan: I redid the entire project from scratch and replaced the .ico files with new ones just to be sure. Now the project works as intended. So...you probably had the right answer after all as nothing else was different. Thanks for the tip! – GeoDirk Mar 07 '11 at 03:24
  • @GeoDirk: I use IcoFX *exclusively* for creating and modifying all of my icon files. It's a great application, and the fact that it's free makes it all that much more awesome. I second Jonathan Peppers's recommendation. And if you didn't have a 256px icon, it's still possible that you had an ICO file that was corrupted in some other way. There are a lot of image editors that supposedly create ICO files, but few of them work as expected. Using a dedicated editor like IcoFX is the best advice you can get. +1 – Cody Gray - on strike Mar 09 '11 at 03:55