开发者

Line of code doesn't follow sequential execution

I'm having a problem with a code that doesnt follow sequential execution although I'm not using threading. My code calls one function and when I'm debugging inside the function, it returns to the line of code following the function call although the function hasnt finished executing, I have no idea why this would happen, any ideas? thanks in advance.

workflow.SaveControlTiempo(solEntity, traId, Usuario.GetUsrId()); // this is my function

// code execution continues here even if the function hasn't finished 
// and since the function hasn't finished I get an exception
RadAjaxManager.GetCurrent(Page).RadAlert("Solicitud Transicionada con \u00c9xito"); 

var javascripFuncti开发者_StackOverflow社区on = "CloseWindow('Solicitud <b>{0}</b><br />Transicionada con \u00c9xito.<li> <b>Etapa Destino: </b>{1}<li><b>Usuario: </b>{2}');";
javascripFunction = string.Format(javascripFunction, solEntity.SOL_CODIGO, solEntity.WKF_ETP_ETAPAS.ETP_DES, 
DNNUtil.GetInstance().GetUserName(solEntity.USR_ID));


It could be because you are hitting a line in the function that causes control to return to the caller. The most obvious example of this is the return keyword, but it's not the only way. Also check to see if there is something like yield break in your code. Exceptions can also give unexpected exit points, although that doesn't seem to be happening here as there is no catch or finally block.

Also note that the debugging information can sometimes get out of sync with the source code so that it looks like you are returning from a position where a return is impossible. To fix this, rebuild all files from clean.


It could be a problem with your debugger. I have had problems before during debugging where Visual Studio would skip breakpoints and even resume execution when I only told it to go to the next statement. The code would still be executed, it just didn't let me step through it.


I found out the problem, a developer created a singleton, and was using static variable in the page to lazy load the singleton, it seems that since this variable were static they were not being disposed when the request ended and that caused the strange behavior in the debugger. Thank you for you answers.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜