G
Guest
There is a bug with the ListView control which is revelead when calling
Application.EnableVisualStyles(). To reproduce follow these steps...
- Create a new winforms app
- Add call to Application.EnableVisualStyles() before Application.Run()
- Add a ListView control and a button to the form
- In the button click handler, add 3 items to the listview items collection
Now go to "Debug...Exceptions" and set the debugger to break on any CLR
exception. Run in the debugger.
When you click the button, you'll see 6 "ArgumentOutOfRange" exceptions
thrown (2 per item)! They are caught inside the method, but this is still a
bug... it should not throw... because:
(a) this causes my application to run very slowly in debug mode (lots of
items)
(b) no exceptions are thrown if EnableVisualStyles() is not called
Does anyone know a workaround?
Application.EnableVisualStyles(). To reproduce follow these steps...
- Create a new winforms app
- Add call to Application.EnableVisualStyles() before Application.Run()
- Add a ListView control and a button to the form
- In the button click handler, add 3 items to the listview items collection
Now go to "Debug...Exceptions" and set the debugger to break on any CLR
exception. Run in the debugger.
When you click the button, you'll see 6 "ArgumentOutOfRange" exceptions
thrown (2 per item)! They are caught inside the method, but this is still a
bug... it should not throw... because:
(a) this causes my application to run very slowly in debug mode (lots of
items)
(b) no exceptions are thrown if EnableVisualStyles() is not called
Does anyone know a workaround?