admin管理员组文章数量:1312737
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:
- Renaming the control
- Moving the control on a new location in the page hierarchy
- Changing its type for sanity check...
- Moving its declaration from the .aspx.designer.vb file to the .aspx.vb file
- Removing it all, then re-publish on CI, then remaking it completely, then try
- Building it on antoher CI machine with same pipeline code
- Building it on CI machine with older pipeline code
- Using a built-in
<asp:PlaceHolder>
control instead of our own custom controls
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?
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:
- Renaming the control
- Moving the control on a new location in the page hierarchy
- Changing its type for sanity check...
- Moving its declaration from the .aspx.designer.vb file to the .aspx.vb file
- Removing it all, then re-publish on CI, then remaking it completely, then try
- Building it on antoher CI machine with same pipeline code
- Building it on CI machine with older pipeline code
- Using a built-in
<asp:PlaceHolder>
control instead of our own custom controls
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?
Share Improve this question edited Jan 31 at 20:46 Pascal Boutin asked Jan 31 at 16:16 Pascal BoutinPascal Boutin 12 bronze badges 5- 2 And the markup and code that allows us here to reproduce the error? Please edit your question and show the markup + code that is failing. Better yet, create a test blank test page, and show the min amount of markup, and min amount of code you have that shows this issue and problem. Without ANY markup or code in your question? We are playing a guessing game here, and really have no more clue then you right now, and that is especially the case without any sample code and markup to reproduce this error. – Albert D. Kallal Commented Jan 31 at 19:29
- I didn't feel that it would be important to show any code extracts because it really seems to be due to a problem during the build process that skip some regeneration of things because it thinks there are no changes regarding the pages markup. The code is well regenerated and up to date in the DLLs but not the actual "markup" itself. But if you have seen any similar results and know what to point at, it would be appreciated. – Pascal Boutin Commented Jan 31 at 20:37
- 1 Is this a web site, or a web site "application"? And without markup that reproduces this issue, then really, what do you expect here? So, that page that breaks? Pull out the markup and code - and build a reproducible example that we can all try. We here are not seeing this issue , so we don't have anything to go on. And since ALL of your pages are not breaking, then something specific to that one page must exist (probably some kind of referencing issue that not resolving correctly). I mean, you might be 100% new to computers, but how is anyone here going to suggest anything so far? We can't. – Albert D. Kallal Commented Feb 1 at 3:52
- “I didn't feel that it would be important to show any code extracts...” I suggest you rethink it. It depends on what to show. Please see: How to create a Minimal, Reproducible Example. – Sergey A Kryukov Commented Feb 1 at 18:09
- and as a follow up? What kind of control are you adding? Are you adding a user control, or some standard asp control? or is this some 3rd party kind of control that you are adding? As noted, without some sample markup, we don't even know WHAT kind of control you are even talking about. So, as you can see, once again, you giving everyone little or next to nothing to go on here, right? And what event is this occurring under? In other words, perhaps order of events is at play here - but then again, we are just playing a guessing game. – Albert D. Kallal Commented Feb 2 at 3:42
1 Answer
Reset to default 0Anwsering 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!
本文标签:
版权声明:本文标题:asp.net - In a WebForms application, newly added control is null at runtime on published site but not in local debugging - Stack 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741907258a2404221.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论