Pascal Boutin
Pascal Boutin

Reputation: 1

In a WebForms application, newly added control is null at runtime on published site but not in local debugging

I just added a new control in an existing page aspx file, assuring the validity of the markup and code itself by running it locally in debug shows correctly the new control and behaviors in page.

But when making it build and publish by CI machine's pipeline agent, pages like it work well (as usual) except that when executing the line of code referencing the new control (a simple container-like div I want to toggle its .Visible property) I get a Object reference not set to an instance of an object exception. I checked it! It's the reference of the control that exists on the .aspx and the .aspx.designer.vb files that, for some reason, is null at runtime. But only for that CI published-deployed web site!

Can someone have a solution?

Things I've already tried:

All giving the same error and result. :(

Note: We are used to do this same kind of addition to pages for some new features needed but in that particular case, having problems, why now?


I've tried something else. I added some controls (simple labels with text) in the aspx file, wihout referencing them in the code-behind file so that it won't crash. It resulted that in my local debugging, I saw the labels but not on the CI built web site. So there's an out-of-sync situation where the code (DLL) is updated but not the "markup" itself.

But, the .aspx files are up-to-date in the folder where resides the site. So where are those changes in the markup supposed to be packaged to? And why are they not rebuilt correctly?

Upvotes: 0

Views: 46

Answers (1)

Pascal Boutin
Pascal Boutin

Reputation: 1

Anwsering my own question...

We found that in fact, the build pipeline wasn't doing the job correctly letting assets/pages untouched while code-behind files were built into the DLL. Resulting that referencing newly added aspx server control elements was giving null pointer exceptions.

Sorry about that!

Upvotes: 0

Related Questions