Magical persistence
-
I have a peculiar bug that's got me baffled. I'm working on a C# winform app in VS2005 and I was trying to make one of its menus dynamic (built from data read from a database). Somewhere along the line the new menu items became doubled so I tried to reverse out the code changes. But no matter what I did these new menu items persisted. I've removed all new code. I've deleted the form's resx. I've emptied the obj and bin directories. I've rebooted my PC. I've saved the form's code in a notepad session, the designer code in another notepad session, deleted the form, then recreated it from the two notepad sessions. The find function cannot locate the text of the new menu items, nor does anything reveal itself when stepping through in debug. No trace shows in the IDE designer. Yet somehow when I run the program there they are! How is this possible? Where is this being persisted? The workaround was to change the parent menu's ID string, so its not urgent ... but I'd still like to understand what's going on.
-
I have a peculiar bug that's got me baffled. I'm working on a C# winform app in VS2005 and I was trying to make one of its menus dynamic (built from data read from a database). Somewhere along the line the new menu items became doubled so I tried to reverse out the code changes. But no matter what I did these new menu items persisted. I've removed all new code. I've deleted the form's resx. I've emptied the obj and bin directories. I've rebooted my PC. I've saved the form's code in a notepad session, the designer code in another notepad session, deleted the form, then recreated it from the two notepad sessions. The find function cannot locate the text of the new menu items, nor does anything reveal itself when stepping through in debug. No trace shows in the IDE designer. Yet somehow when I run the program there they are! How is this possible? Where is this being persisted? The workaround was to change the parent menu's ID string, so its not urgent ... but I'd still like to understand what's going on.
Have you checked the content of the database? :)
Luc Pattyn [Forum Guidelines] [My Articles]
DISCLAIMER: this message may have been modified by others; it may no longer reflect what I intended, and may contain bad advice; use at your own risk and with extreme care.
-
I have a peculiar bug that's got me baffled. I'm working on a C# winform app in VS2005 and I was trying to make one of its menus dynamic (built from data read from a database). Somewhere along the line the new menu items became doubled so I tried to reverse out the code changes. But no matter what I did these new menu items persisted. I've removed all new code. I've deleted the form's resx. I've emptied the obj and bin directories. I've rebooted my PC. I've saved the form's code in a notepad session, the designer code in another notepad session, deleted the form, then recreated it from the two notepad sessions. The find function cannot locate the text of the new menu items, nor does anything reveal itself when stepping through in debug. No trace shows in the IDE designer. Yet somehow when I run the program there they are! How is this possible? Where is this being persisted? The workaround was to change the parent menu's ID string, so its not urgent ... but I'd still like to understand what's going on.
Without seeing your code, I wouldn't know a definitive answer (I probably wouldn't have one, even after seeing your code either :) ), but is there any chance that your routine is being called twice?
Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”
-
Without seeing your code, I wouldn't know a definitive answer (I probably wouldn't have one, even after seeing your code either :) ), but is there any chance that your routine is being called twice?
Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”
Nope. I've commented out large swathes of code so that now all that happens is the form's constructor calls InitialiseComponents. I've verified this by stepping through every line in debug. Additionally, while the text of the original menus can be found using the IDE's search function, the text of the 'magical' menus cannot be found.
-
Have you checked the content of the database? :)
Luc Pattyn [Forum Guidelines] [My Articles]
DISCLAIMER: this message may have been modified by others; it may no longer reflect what I intended, and may contain bad advice; use at your own risk and with extreme care.
I can't see anything suspicious in the database. Besides, all access is screened through stored procedures and I never coded for menus to be stored or retreived from the database (just a simple function that returned a list of strings from which the 'magical' menus were built - that code has since been removed). But just to be sure I took the database offline: the 'magical' menus still appear.
-
I have a peculiar bug that's got me baffled. I'm working on a C# winform app in VS2005 and I was trying to make one of its menus dynamic (built from data read from a database). Somewhere along the line the new menu items became doubled so I tried to reverse out the code changes. But no matter what I did these new menu items persisted. I've removed all new code. I've deleted the form's resx. I've emptied the obj and bin directories. I've rebooted my PC. I've saved the form's code in a notepad session, the designer code in another notepad session, deleted the form, then recreated it from the two notepad sessions. The find function cannot locate the text of the new menu items, nor does anything reveal itself when stepping through in debug. No trace shows in the IDE designer. Yet somehow when I run the program there they are! How is this possible? Where is this being persisted? The workaround was to change the parent menu's ID string, so its not urgent ... but I'd still like to understand what's going on.
Another piece of the puzzle: whatever is bringing back these dynamic menus (that I no longer create but still appear) is happening after the form's Load method has run and before the first time the form's Activate method is run. (This was determined by stepping through the code and looking at the number of submenus listed in the IDE's "Locals" window on the last line of the Load and the first line of the Activate ... 14 submenus had been added between these two points.)
-
Another piece of the puzzle: whatever is bringing back these dynamic menus (that I no longer create but still appear) is happening after the form's Load method has run and before the first time the form's Activate method is run. (This was determined by stepping through the code and looking at the number of submenus listed in the IDE's "Locals" window on the last line of the Load and the first line of the Activate ... 14 submenus had been added between these two points.)
Okay, I've found the root of the problem. Even though this thread is now old I figure I should post here anyway in case someone gets a similar problem and finds this thread in a Google search. (Don't you just hate googling for a problem and find loads of other people asking the same questions years before and then they stop without telling you what solution they eventually used?) The third party controls I was using were placing data in Isolated Storage. Specifically (on Vista) ...
AppData
/Local
/IsolatedStorage
/(gibberish)
/(gibberish)
/Url.(gibberish)
/StrongName.(gibberish)
/Files
/SyncfusionToolsStateInfo.bin.This file had become corrupted. According to the component authors deleting this file should solve the problem (a new version is recreated). However, in my case my Windows set up had become unstable so I reinstalled the whole of Windows instead. Regardless, Isolated Storage is another place to look when you have these kinds of problems. (I hope this helps somebody, someday.)