Very simple project - create a C# Windows Forms application. Add one DataGridView to the form, not bound to any data source. Add one column. In the form initiator code, add some rows, and hide some:
public Form1()
{
InitializeComponent();
dataGridView1.Rows.Add("A1");
dataGridView1.Rows.Add("A2");
dataGridView1.Rows.Add("A3");
// dataGridView1.Rows.Add("b1");
// dataGridView1.Rows.Add("b2");
// dataGridView1.Rows.Add("b3");
// dataGridView1.Rows.Add("c1");
// dataGridView1.Rows.Add("c2");
dataGridView1.Rows[0].Visible = false;
dataGridView1.Rows[1].Visible = false;
// dataGridView1.Rows[2].Visible = false;
// dataGridView1.Rows[7].Visible = false;
// dataGridView1.Rows[6].Visible = false;
}
The commented lines can be uncommentedif you want to play with this problem some, but this code should be sufficient as it stands. Now, run the program, and sort the column a few times. I get:
An unhandled exception of type 'System.StackOverflowException' occurred in System.Windows.Forms.dll
The call stack looks like this (the last row repeats for ever, as you'd expect with a stack overflow exception) System.Windows.Forms.dll!System.Windows.Forms.PropertyStore.LocateObjectEntry(short entryKey = 92, out int index = 0) + 0x1d bytes System.Windows.Forms.dll!System.Windows.Forms.PropertyStore.GetObject(int key, out bool found = false) + 0x37 bytes System.Windows.Forms.dll!System.Windows.Forms.DataGridViewRow.AccessibilityObject.get() + 0x3a bytes System.Windows.Forms.dll!System.Windows.Forms.DataGridView.DataGridViewAccessibleObject.GetChild(int index) + 0xa3 bytes System.Windows.Forms.dll!System.Windows.Forms.DataGridViewRow.DataGridViewRowAccessibleObject.Bounds.get() + 0x16f bytes System.Windows.Forms.dll!System.Windows.Forms.DataGridViewRow.DataGridViewRowAccessibleObject.Bounds.get() + 0x179 bytes System.Windows.Forms.dll!System.Windows.Forms.DataGridViewRow.DataGridViewRowAccessibleObject.Bounds.get() + 0x179 bytes
I am seeing this error occasionally in real code that I'm trying to make work - this sample is deliberately small to make sure that it's clear that I'm not doing anything special. Has anyone else encountered this issue, and is there a solution? I've searched as many places as I can think of, but not yet found a solution. Alun. ~~~~ | | Alun Jones Friday, August 14, 2009 11:09 PM | Hello Alun, I performed a test on my side, But I cannot reproduce the issue on Visual Studio 2005 SP1 and Visual Studio 2008 SP1 on Windows Vista. To isolate the problem, could you please try the following thing 1. Try the application on the other machine to see if the problem still happens 2. Install the latest Visual Studio service pack to see if the problem still happens As I cannot reproduce the issue, to troubleshoot the issue, could you please be more specific about the problem? It would be more helpful if you can provide a simple reproducible sample project. I appreciate your work on providing these information. Thanks, Rong-Chun Zhang MSDN Subscriber Support in Forum If you have any feedback on our support, please contact msdnmg@microsoft.com
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us. | | Rong-Chun Zhang Monday, August 17, 2009 7:58 AM | I am using Visual Studio 2008 SP1, with all current fixes. I also tried this on a fresh installation of Windows 7 and Visual Studio 2008 SP1, and was able to reproduce the issue there. Perhaps this requires .NET 3.5 SP1. I do have a sample project that reproduces the issue (though you have to single-click on the column header about six times to trigger the behaviour) - I don't see a way to attach it to this thread - how would you prefer that I get it to you?
Alun. ~~~~ | | Alun Jones Monday, August 17, 2009 6:00 PM | Thanks for your effort, Alun. I've tried this on both x86 and x64 version of Windows 7 RTM(version 6.1.7600.16385), but I still cannot reproduce the issue. If you didn't have .NET 3.5 SP1 installed, I recommend you install the service pack. You can send the reproducible sample project to me via my email(v-rzhang[at]microsoft.com) or upload it on a file sharing website and paste the url here. Thanks, Rong-Chun Zhang MSDN Subscriber Support in Forum If you have any feedback on our support, please contact msdnmg@microsoft.com
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us. | | Rong-Chun Zhang Tuesday, August 18, 2009 5:09 AM | I've emailed this to Rong-Chun, but I'm including it here in the hopes that someone else will demonstrate that this can be reproduced really easily. The project code can be found at http://msmvps.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/alunj/2158.DGVtest.zip- you can compile it, or simply try to run the copy in the bin/release folder. When the datagrid appears, click the column header to sort the column. You'll need to sort and re-sort two or three times in order to make it crash, in my experience. Please post here if you can repeat my results - I've tried this on several machines, including a freshly-installed Windows 7 RTM with Visual Studio 2008 SP1 and .NET 3.5 SP1. | | Alun Jones Thursday, August 20, 2009 3:44 AM | Hello Alun, I've tried your project on my side, but I still cannot reproduce the problem. Did you tried with English Version of Win7 RTM? Thanks, Rong-Chun Zhang
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us. | | Rong-Chun Zhang Thursday, August 20, 2009 11:14 AM | Yes - I only have the English (US) version. To be clear, this failure also occurs in the English version of Windows Vista with current service packs applied. | | Alun Jones Thursday, August 20, 2009 12:59 PM | I have managed to find a machine on which the code does not fail. This machine is running Windows XP SP3, and the hardware is very different from the first two tests (which were both on a Thinkpad T61p with NVidia graphics chipset). The working machine is a Dell Latitude D630 with Intel graphics. There are several other variables to consider- the working machine has no Visual Studio installed, for instance. I will try and further narrow down the system details that might cause this issue. In the meantime, perhaps someone else can try and reproduce it on their system? As I mentioned earlier, in one test, I installed Windows 7, Visual Studio 2008, service packs and patches, and then ran the program. Sorting a few times caused the stack overflow. This should reproduce on other systems, too. Note - the Vista installation on which it failed is x86; the Windows 7 installation on which it failed is x64; the XP installation on which it worked is x86. - Edited byAlun JonesMVPThursday, August 20, 2009 5:09 PM
- Edited byAlun JonesMVPThursday, August 20, 2009 5:18 PM
-
| | Alun Jones Thursday, August 20, 2009 5:01 PM | Well, I slowly started removing things to do with .NET, and as soon as I removed the .NET Compact Framework, the application worked without fail.
Adding it all back in again (and running Outlook 2007) apparently caused the failure to come back.
I can't fix this by just removing the .NET Compact Framework, so it must have been something else.
I'll investigate more later. In the meantime, try testing this on a _full_ installation of Visual Studio 2008, MSDN and all service packs and patches. | | Alun Jones Friday, August 21, 2009 3:23 AM | Hello Alun, I've also tested it on my colleagues' machine, but I still cannot reproduce the issue. It seems that the issue is related to the installation of your machine, please try to run the application on another machine to see if still happens. Thanks, Rong-Chun Zhang
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us. | | Rong-Chun Zhang Tuesday, August 25, 2009 8:52 AM | It works fine on other machines, and it works fine in safe mode, so I have to assume it's something to do with the video hardware and/or drivers, because I can wipe the machine _completely_, install a fresh operating system and run the program, and it fails. So, here's my specs: Lenovo Thinkpad T61p 256MB nVIDIA Quadro FX 570M 3GB RAM
Please see if you can find a similar machine to reproduce this issue on. Note that this problem seems to happen even if I use the "Standard VGA Adapter" driver in Windows 7. I can't boot to safe modeevery time I wantto use this application. | | Alun Jones Friday, August 28, 2009 3:56 AM | Hello Alun, Thanks for your feedback. Unfortunately, I cannot find Lenovo Thinkpad T61p in the lab. Does the issue happens on all the Lenovo Thinkpad T61p you have? Did you overlock the Lenovo Thinkpad T61p computer? Thanks, Rong-Chun Zhang
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us. | | Rong-Chun Zhang Friday, August 28, 2009 10:56 AM | I have only the one T61p. It is not overclocked. | | Alun Jones Friday, August 28, 2009 12:38 PM | Further information - if I make only rows 0 and 2 invisible (and 1 visible), the program crashes on initially displaying the data grid. Where do I go to move forward with this? As it stands I am totally unable to rely on this application performing properly, and I have no way to prevent this or work around it. I have no other unexplained crashes in other applications, so I presume my system is functioning normally, as it has done in the nearly two years since I bought it. Since the problem goes away in Safe Mode, I have to assume that one of the drivers that came with Windows (Vista and Seven) is at fault here. | | Alun Jones Tuesday, September 01, 2009 8:17 PM | Hello Alun, Sorry for the late response. As the problem didn't happen in safe mode, I also guess that this might be caused by the driver, To solate the problem, please try to uninstall the driver and use the standard driver to see if the problem still happens. If the problem still happens, you can catch the dumpfile when the exception happens and share with us on a file sharing website. http://support.microsoft.com/kb/241215Thanks, Rong-Chun Zhang MSDN Subscriber Support in Forum If you have any feedback on our support, please contact msdnmg@microsoft.com
Please remember to mark the replies as answers if they help and unmark them if they provide no help. Welcome to the All-In-One Code Framework! If you have any feedback, please tell us. - Edited byRong-Chun ZhangMSFT, ModeratorWednesday, September 09, 2009 9:02 AMtypo
-
| | Rong-Chun Zhang Wednesday, September 09, 2009 9:01 AM | Thanks for getting back to me - I'll have to try this later on a Vista install, as the current version (8.1)of the user mode dumper refuses to install on Windows 7 x64, and rather ironically, the setuphangs after letting you know it won't install. | | Alun Jones Wednesday, September 09, 2009 7:43 PM | I have just hit the same problem. System.StackOverflowException' occurred in System.Windows.Forms.dll datagridview only happens when some of the rows in the dataview have been made invisible - I'm filtering the rows by the value in a column so that it is easier to find the row that's wanted. Perfectly ok selecting the same row when none of the rows have been made invisible. Have tried your sample at the top and get the error on that too.
Am using Vista Ultimiate SP1 and Visual Studio 2008. It's a desktop X86NVDIA GeForce 9600 GT - if there's anything I can check to help find out what we have in common please let me know. | | June S Thursday, September 10, 2009 1:02 PM | Hi, I think I got the same problem as Alunbut in a Vb .NET 2008 prog where I have a grid viewlisting stuff that you can filter so that you can find stuff ok - when it is unfiltered (all rows visible) double-clicking on the rows does the event okbutdouble-clicking on a row when the filter is applied (ie some rows hidden). Gives the stack overflow. Tried Alun's little sample above in C# and got the stack overflow after I clicked the column heading 3 times to sort it. Have had a go at creating a dump from that - not done it before so apologies if it's rubbish. (used Debug Diagnostics tool 1.1 found through google as the one on your link said it wasn't ok with Vista SP1). Anyway it's on [URL=http://www.4shared.com/file/131881636/493a9c89/stackoverflowdump_for_datagridviewwithinvisiblerows.html]stackoverflowdump for datagridviewwithinvisiblerows.zip[/URL] It would be good if we could get to the bottom of this otherwise I guess I'll have to disable my filter which would make the program much less useable. Regards, June Sunday 13 Sept 2009 have found that the workaround in http://connect.microsoft.com/VisualStudio/feedback/Workaround.aspx?FeedbackID=343158ie deactivate the TabletInputService on Windows Vista (Business) works for me. But our customer site is large so I cant be sure this will be an acceptable long term workaround. But maybe knowing this will enable you to reproduce it? | | June S Friday, September 11, 2009 10:24 AM | This is likely to be the same problem as the one I reported - I too get the same StackOverflowException when I check a box on a row when other rows are hidden. I hope I will eventually have time to try this again in a Vista installation, because theuser dump tool doesn't install in Windows 7. | | Alun Jones Monday, September 14, 2009 9:58 PM | I hate to jinx it by posting here, but on Thursday night, I downloaded the new Quadro FX video driver that was offered from the Microsoft Windows Update applet. Since then, I have been unable to reproduce the crash on my Windows 7 system. Of course, this may be coincidental, but I'd suggest trying a new video driver if one is available. Ideally get it from Microsoft, not from NVidia, because I have noticed that the NVidia-hosted drivers tend to be of varying quality, but the ones from the Microsoft site are often stable. | | Alun Jones Sunday, September 27, 2009 3:13 AM |
|