Click here to Skip to main content
15,895,799 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,
I am writing a C# Windows Forms application that displays lots of icons in a datagridview. It works correctly when debugging is used. However when start without debugging is used, it displays an error message (named: .NET-BroadcastEventWindow.2.0...) for each icon that is "corrupt" or "not compatible" which is very disturbing. It works fine later on.
Can someone tell how to solve it, either how to detect corrupt or not compatible images or just ignore the error messages :)?
Thanks
Edit:
The error message shows the path of images that are corrupt. Windows Photo Gallery or Picasa cannot open them either. Somehow they are really corrupt. I need to detect them or ignore the errors (like debugger does) to get rid of error dialogs.

Edit2:
Actually I have found the answer. Some files contain more than 1 icons in it although they are .ico files (which is why photo gallery cannot open them). As far as I observed those are just 4 to 32-bit or small-middle-large sized variations of the same icon and for some reason my icon extraction does not work properly on them. What interesting is "new Icon(path)" is able to return one of the icons in it and it is enough good for this application.

What still confuses me is how and where that corrupt image exception is thrown, why I was not able to catch it? How does debugger catch and ignore it?
Posted
Updated 4-Apr-10 12:37pm
v8

Do the images show OK in debug mode ? Why are they corrupted ? Where do they come from ?
 
Share this answer
 
Oh, OK. Perhaps as you iterate over them you can try to load them in your own code to see which ones are corrupted ?

You should edit your post to add detail, not post an 'answer' that's really more of your question.
 
Share this answer
 
No a usual X is displayed (which is fine). Windows Photo Gallery cannot display them either. I get the imagelist from registry. I am trying to display all the icons in defaulticon keys.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900