Link to home
Start Free TrialLog in
Avatar of hismightiness
hismightiness

asked on

Visual Studio - After rebuilding, new code changes are not applied

This is a WEIRD problem!!!  I so far have not been able to find any help on Google, or the Microsoft KB.  (Or the EE search either)

Has anyone ran across an instance where only ONE codebehind file's changes are not being rebuilt and compiled with the rest of the files in the project(s)?  

Any changes made in the codebehind for just one file are not reflected after rebuilding the projects and viewing in a browser.  However any other codebehinds that are altered get rebuilt, compiled, and correctly fire in any page requests that call them.

In order to try and get this file to have its changes built with the rest of the project files, I have verified that the Class names and namespaces match in the codebehind and HTML files.  I have also made changes to the codebehind and HTML to hopefully "trick" Visual Studio into thinking that a change has been made and rebuild it accordingly.  I even put in a JavaScript alert in the PageLoad event to get registered as a startupscript to let me know the changes are getting reflected.

I am using VS.Net 2003.  Please help...  :(
Avatar of raterus
raterus
Flag of United States of America image

are you sure you haven't replaced codebeind="mypage.aspx.vb" with src="mypage.aspx.vb".  Also, is the codebehind file added to the project.  You should be able to right-click on the aspx file, and select "view code", if the correct codebehind file doesn't pop up, then something is wrong...
Avatar of hismightiness
hismightiness

ASKER

Unfortunately, those have been checked.  I am a hot key person, so I often use F7 and Shift+F7 to view HTML & Codebehind files.  My methods and right-clicking and choosing "View Code" all bring up the correct file.  I also do not see any product updates for VS.Net 2003 (except for use with Crystal Reports - I have but do not use anymore).
Remove the file completely from the project, then go move the files in the directory somewhere else, then create a new file with the old name, cut/paste the aspx/codebehind from the old files into this.  Keep the new @page directive, and anythign else VS.net sets up for you automatically.  I don't see why this shouldn't fix your problem.
could u post the page directive class name etc .. r u using a reserved word for the page .. i have heard of an instance where someone had a problem when he named the page as "grid"
This is a HIGLY modified portal project:

HTML PAGE:
<%@ Page CodeBehind="Default.aspx.vb" language="vb" AutoEventWireup="false" Inherits="ASPNET.StarterKit.Portal.MarketingAdminDefaultPage" %>
<%@ Import Namespace="ASPNET.StarterKit.Portal" %>

CODE BEHIND:
Namespace ASPNET.StarterKit.Portal
    Public Class MarketingAdminDefaultPage

I will try the file modification soon...
ARGGGHHHH!!!!  Still happening...
something has to be different .. is it in a different directory or something? does the directory have its own web.config file? what happens when u copy the code to a different file which is geting compiled? did u face this problem when u first added the page .. ie. was this page never compiled?
The page is contained within a subdirectory and is not in a separate project or anything.  The file initially was just a single form.  Recently, I made it much more complicated by adding more form functionalities with separate views and what not.  At first, all my changes were occurring just fine.  I was just about happy with the functionality and began fine-tuning the form (adjusting error messages, etc.), when my last few changes were not getting reflected after rebuilding the project.  There are 2 very minor text changes that are not getting compiled.  

I order to really simplify things to see what was going on, I created a totally new form in the directory and copied/pasted the original code into it and the same thing was happening.  Then, to break it down even further, I broke the form down even further into 3 separate forms and the SAME THING IS STILL HAPPENING!!!  This is so frustrating!!!   :(
open up the project file (.vbproj / .csproj) and make sure there is no funny business going on in there.  It is just a text file that should contain every file in your project.  Also, are you SURE the changes aren't being recompiled, and it's just a bug you are experiencing...
It isn't a bug in my design.  For instance, one of the changes I am expecting to see is in the text of one of the form status messages.  An example would be:

"Request #12345 was successfully sent to the supervisor."

A change I expect to see is:

"Request #12345 has been successfully re-sent to the supervisor."

No dice!  :(

I am going to look at the project file now, but I am not sure what I am looking for.
Okay, I took a look at the project file and compared it to others.  Everything appears to be in order.  The pages are all marked correctly as Compile, Content, etc. and their dependencies are all correct.  I still have not been able to find anything in Microsoft's knowledge base on this either.  Grrr...
ASKER CERTIFIED SOLUTION
Avatar of raterus
raterus
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
HOLY INSIGHT BATMAN!!!  That is an awesome tool!  I cannot believe that it is letting me look at my code from the DLL.  

Okay, enough of my school girl giddiness...

I just verified that my changes are not compiled into the DLL.  Argh!  They are definitely in the codebehind though.
this is really wierd .. am pretty sure it has to be due to some changes to the project/environment etc .. cannot be of much help unless I see the whole thing and try and verify a couple of things .. just to be sure .. did u also try deleting the dll from the project? Is it getting recreated after compile .. just to be sure also confirm the URL in IIS .. ie the page is present in the same directory ..
here's something to try...

move the entire codebehind class declaration/guts to another codebehind file.  See if it's not compiled then...Rather than knocking your head, might be time to let us see the whole project..if at all possible.
The DLL is indeed getting recreated.  I went and viewed the file details immediately because that is the first thing I thought of.  All files are present.  I am past that point in troubleshooting.
btw, the reflector lets you go into any .dll you can put your hands on, even the system .dll's, comes in quite handy sometimes!  The only thing you can't see is obfuscated assemblies
Maybe I am starting to get cross-eyed after looking through this for over a day now...  The textual update got compiled after I ran the project through the debugger.  Can anyone explain that one?  However, while stepping through the code, the code below is my other change.  

Do you see anything wrong with it?  Because this is now getting added too and I see it in the HTML output.  However, I think this is one of those cases where I just need a fresh set of eyes on it.  I am not seeing any JS errors and the focus is not set on the field in question.

            Dim strFocusScript As String = "<script language=""javascript"" type=""text/javascript"">" & _
                "document.getElementById('" & cmdSubmitResend.ClientID & "').focus();" & _
                "</script>"
            If Not Page.IsStartupScriptRegistered("FocusSubmitResend") Then
                Page.RegisterStartupScript("FocusSubmitResend", strFocusScript)
            End If

I greatly appreciate your detailed help, raterus.
the script looks fine to me, is this just a client-side problem now?
Yeah, and the ID in the HTML matches the HTML output:

<input type="submit" name="cmdSubmitResend" value="Re-Send Request" onclick="if (typeof(Page_ClientValidate) == 'function') Page_ClientValidate(); " language="javascript" id="cmdSubmitResend" title="Click here to re-send the request" class="CommandButton" />

<script language="javascript" type="text/javascript">document.getElementById('cmdSubmitResend').focus();</script>

I need a vacation...
BTW, why would something from a single file get compiled only after running through the debugging process?
and I'm guessing you want to cursor to focus this button and it isn't?
The beaches aren't as crowded yet...just go, don't worry about this, go!
It isn't dependant on anything or part of the application design...  It is just one of those many user-friendly things that I always include in my applications.  At this point, I am already willing to just let this one go since it is the only thing left to keep me from releasing this upgraded area.  Is it time to go home yet?
raterus, your post with the link to the reflector is what led me to run it through the debugger.  I didn't do that before because I already knew the logic was being followed correctly, but the text output wasn't updated.  Thanks a million!
BTW, i tried this .. a normal button in a aspx page and setting focus in the body onload .. it does not really put "focus" .. dotted rectangle on the button .. so how r u testing this and confirming that the button focus is not set? is it that the focus is set on some other control?
I washed my hands of it.  Like I said, this is something I do for every form...  It isn't new.  It is the same bit of code I use on most of my forms.  This one will be an exception.  Consider this one deployed...