I’ve spent a lot of time this week updating ASP.NET AJAX code samples from RC to RTM. I discovered some changes that aren’t documented in the migration guide. One of them in particular cost me several hours of work.

First, as the migration guide notes, the AutoCompleteExtender control was moved from the CTP (preview) bits to the ASP.NET AJAX Control Toolkit. If you built pages that use AutoCompleteExtender, you can get them working again by installing the control toolkit and changing your <asp:AutoCompleteExtender> tags to <ajaxToolkit:AutoCompleteExtender>. In the unlikely event that you wrote JavaScript code that directly uses the Sys.Preview.UI.AutoCompleteBehavior class in PreviewScript.js, you’ll need to copy AutoCompleteBehavior.js from the control toolkit, import it into your app, and change the class name to AjaxControlToolkit.AutoCompleteBehavior in your code.

Second, window.debug changed to Sys.Debug in the core script file MicrosoftAjax.js. If you wrote JavaScript code that uses the debug object, you’ll need to change all instances of windows.debug to Sys.Debug.

Third, page methods are now disabled by default and must be explicitly enabled using the ScriptManager control’s new EnablePageMethods property. If any of your pages have page methods, change the ScriptManager declaration in those pages (or your master pages) to look like this:

<asp:ScriptManager EnablePageMethods=”true” … />

Fourth, in addition to removing the AutoCompleteBehavior class from PreviewScript.js, Microsoft also removed PopupBehavior and HoverBehavior. These, too, were moved to the control toolkit in a last-minute push to eliminate any dependency between the control toolkit and the CTP.

It’s the last change that bit me. I’m using a custom control that relies on both PopupBehavior and HoverBehavior. The control stopped working once I upgraded to RTM. I stepped through the code in the debugger (JavaScript debugging; now there’s an oxymoron!) and discovered that attempts to instantiate PopupBehavior and HoverBehavior were throwing exceptions. Thinking maybe these classes had been removed from PreviewScript.js, I looked in the copy of PreviewScript.js installed to my hard disk and found that the classes were still there. Puzzled, I started digging deeper. It turns out that the real PreviewScript.js–the one embedded as a resource in Microsoft.Web.Preview.dll–is not the same one that’s installed on your hard disk when you install the January CTP, and PopupBehavior and HoverBehavior were removed from the embedded version. This was a simple oversight on Microsoft’s part. The team made some late changes to PreviewScript.js and forgot to go back and refresh the version of the file that the MSI copies to your hard disk. (This may be fixed by the time you read this; I don’t know.)

So…if you use the preview bits, don’t rely on the source code files that come with them. Instead, extract the real source code files from Microsoft.Web.Preview.dll so you can see what the browser sees.