sushant d
asked on
mysteriously code vanishes after build
during publish, out of below code one line is gets excluded . it's weird , does anyone else has seen such thing.
public JsonResult GetMethod(ProDetails criteria)
{
PResponseApp response = new PResponseApp();
criteria.UserName = "21927198"; // this line disappears resulting in null value for username
response = ProDetailsObjBL.GetProTerm inal(crite ria);
return Json(response, JsonRequestBehavior.AllowG et);
}
public JsonResult GetMethod(ProDetails criteria)
{
PResponseApp response = new PResponseApp();
criteria.UserName = "21927198"; // this line disappears resulting in null value for username
response = ProDetailsObjBL.GetProTerm
return Json(response, JsonRequestBehavior.AllowG
}
ASKER
thanks for the reply, what I mean is from the code above , below line (when I decompile the assembly & check ) is not seen, this happens only after publish
also the above object's other properties persist value, the object is not null
criteria.UserName = "21927198";
also the above object's other properties persist value, the object is not null
Sure that you looked at the correct compilation result?
How is the UserName property defined?
How is the UserName property defined?
ASKER
Yes I checked the relevant result. the occurrence is not consistent and random. userName is simple string .
actually I'm reviewing someone's code. is it even possible to happen ? I've seen it first time such selective code exclusion
actually I'm reviewing someone's code. is it even possible to happen ? I've seen it first time such selective code exclusion
Three possible reasons:
- Your way to compile code is not reliable. And you looked at a piece of compiled code create from a different source version.
- VS didn't think it needs to compile that part.
- It's dead code.
Two thinks which should help:
- Unit tests.
- Clean builds.
- Your way to compile code is not reliable. And you looked at a piece of compiled code create from a different source version.
- VS didn't think it needs to compile that part.
- It's dead code.
Two thinks which should help:
- Unit tests.
- Clean builds.
Do you have the file open somewhere else?
ASKER
Hi Shaun, no the file isn;t open . the above behavior repeated today with a different project as well .a newly added object property & few lines of associated code did not get included in the published version.
somehow it seems an older version of file is getting referred to. but don't know how, since in publish routine only local/workspace code is considered despite the same being present in source control
somehow it seems an older version of file is getting referred to. but don't know how, since in publish routine only local/workspace code is considered despite the same being present in source control
This question needs an answer!
Become an EE member today
7 DAY FREE TRIALMembers can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
What do you mean exactly?
Open in new window
btw, you have a lot of dependencies in that method.