Line of code does not match sequential execution

I am having a problem with code that is not sequential even though I am not using threading. My code calls one function, and when I debug inside the function, it goes back to the line of code following the function call, although the function hasn't finished executing, I have no idea why this will 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 javascripFunction = "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));

      

+2


a source to share


3 answers


I figured out this issue, the developer created a singleton and used a static variable on the page to lazy load the Singleton, it seems that since this variable was static they were not removed when the request ended and this caused strange behavior in the debugger. Thank you for your answers.



0


a source


This could be because you are pressing a line in a function that causes the control to return to the caller. The most obvious example of this is the keyword return

, but it is not the only way. Also check if your code contains something like yield break

. Exceptions can also give unexpected exit points, although this doesn't seem to be happening here as there are no catches or finally blocks.



Also note that the debug information may sometimes be out of sync with the source code so that it looks like you are returning from a position where returning is not possible. To fix this, rebuild all files from scratch.

+1


a source


This could be a problem with your debugger. I had problems before while debugging where Visual Studio would skip breakpoints and even resume execution when I just tell it to move on to the next statement. The code would still get executed, it just wouldn't let me go through it.

+1


a source







All Articles