It's possible you have other unreleased controls in that page then. Pretty sure this fix will take care of the list item issue. You should check this with a simple page that just contains a list of some sort. It works for me and didn't prior to the change.
The only other controls are 2 text boxes and a button as shown. If I take out the radio list the page recompiles fine.
To find hung references:
* Set a breakpoint in WebControl.Destroy
* Run your app
* Hit page you think has hung refs
* Clear All/Close All
When you hit the Clear All/Close FoxPRo will trigger on any lingering controls that weren't released properly. Check the ID to or Class to figure out which ones.
Not sure I got the above steps right but I did get it to tell me WWWEBLISTITEM is in use which points right back at the radio button list.
I did use the updated webcontrol.prg that you posted for Bob.
--stein
So I always drop by this site once or twice a week just to see what's up. For some reason, I did not do so last week. So I missed seeing this thread. So when my tech complained about not being able to recompile one of my pages, I was not aware of the radio button issue. So I just spent a good 3 hours trying to figure out what I had introduced into the page to cause the problem before concluding that the radio button was the problem. Then I decide to finally check out the board and find this.
Unfortunately the fix did not work for me either. Here's my WCSX code:
<div id="mainBody" style="display:none"> <form id="form1" runat="server"> <ww:wwWebErrorDisplay runat="server" id="ErrorDisplay" /> <b>Base Path:</b> <WW:WWWEBRADIOBUTTONLIST ID="lstBase" runat='server'> <asp:ListItem Selected="True" Value="WConnect">WConnect Folder</asp:ListItem> <asp:ListItem Value="Manager">Manager Folder</asp:ListItem> <asp:ListItem Value="AW">ACEweb Folder</asp:ListItem> </WW:WWWEBRADIOBUTTONLIST> <br /> <b>Additional Path and File Mask:</b> <br /> <ww:wwWebTextBox ID="txtPath" runat="server" Visible="True" Width="380px" AutoPostBack="True" Change="txtPath_change" /><br /><br /> <b>Main template folder:</b> <ww:wwWebTextBox ID="txtTemplateFolder" runat="server" Visible="True" Width="39px" AutoPostBack="True" Change="txtFolder_change" Text="ace" /> <font size="-2">(Leave as "ace" unless using an Alternate Interface)</font><br /> <ww:wwWebButton ID="btnGo" runat='server' Width='80' Text="Go" Click="btnGo_Click" OnClientClick="return ok2Go('ED');" /><br /><br /><br /> </form>
If I load the page, make a change to the source, and try to reload I get the outstanding references error. I modified wwWebListControl :: ClearItems in webcontrol.prg per your example. Do I also need to change wwWebListControl :: Dispose?
--stein
Can you give me an example? I used your radio button example which worked fine.
Anything that gets added via AddControl() adds to the Items collection and should be removed by the dispose() call. It seems to work for me here. Did you put this in the right place? wwWebListControl :: Dispose and ClearItems().
+++ Rick ---
I think that made it worse. List controls that are populated manually through the code behind now hang also.
~bob
Yeah I noticed this yesterday too as I was looking at Luca's example. I had to stop and start.
Hanging reference there for sure have to see what's happening. Odd that it fires the first time though...
Ok, took a look. I think the issue is that the list items aren't cleaning up. In fact this is a problem for all list controls not just the RadioButtonList (ie. listbox, dropdownlist).
The fix is to explicitly call Dispose() on the child items:
************************************************************************ * wwWebListControl :: ClearItems **************************************** *** Function: Clears out all manually added items and the DataSource *** Assume: *** Pass: *** Return: ************************************************************************ FUNCTION ClearItems() LOCAL lnX FOR lnX = 1 TO this.Items.Count lnItem = this.Items.aItems[lnX] lnItem.Dispose() ENDFOR THIS.Items.Clear() this.DataSource = "" ENDFUNC * wwWebListControl :: ClearItems
This seems to fix the problem and make changes work again.
+++ Rick ---
Hi Rick,
Drop a radio list on an empty page and explicitly add some items as shown below and hit it. Then make a change and hit it again, you will get this error:
Compilation Error: File cannot be closed because outstanding references exist.
<ww:wwWebRadioButtonList ID="wwWebRadioButtonList1" runat="server"> <asp:ListItem>Item 1</asp:ListItem> <asp:ListItem>Item 2</asp:ListItem> <asp:ListItem>Item 3</asp:ListItem> <asp:ListItem>Item 4</asp:ListItem> <asp:ListItem>Item 5</asp:ListItem> </ww:wwWebRadioButtonList>
I stepped through wwControl.Dispose() and can see your code to explicitly release child controls firing on the first hit and working as designed. On the second hit (after a change was made to the page that requires a recompile), Dispose() is not called for the radio control or any others after it on the page.
That's as far as I got debugging this.
~bob